Skip to content

Commit f05b212

Browse files
committed
bugfix:ShortcutProxyActivity Only for Plugin
1 parent 0030985 commit f05b212

1 file changed

Lines changed: 26 additions & 4 deletions

File tree

project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/stub/ShortcutProxyActivity.java

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@
2424

2525
import android.app.Activity;
2626
import android.content.Intent;
27+
import android.content.pm.ResolveInfo;
28+
import android.os.Build;
2729
import android.os.Bundle;
30+
import android.os.RemoteException;
2831

2932
import com.morgoo.droidplugin.core.Env;
3033
import com.morgoo.droidplugin.pm.PluginManager;
@@ -47,8 +50,14 @@ protected void onCreate(Bundle savedInstanceState) {
4750
if (forwordIntent != null) {
4851
forwordIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
4952
forwordIntent.putExtras(intent);
53+
//安全审核问题
54+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
55+
forwordIntent.setSelector(null);
56+
}
5057
if (PluginManager.getInstance().isConnected()) {
51-
startActivity(forwordIntent);
58+
if (isPlugin(forwordIntent)) {
59+
startActivity(forwordIntent);
60+
}
5261
finish();
5362
} else {
5463
waitAndStart(forwordIntent);
@@ -65,13 +74,24 @@ protected void onCreate(Bundle savedInstanceState) {
6574
}
6675
}
6776

77+
private boolean isPlugin(Intent intent) {
78+
try {
79+
ResolveInfo info = PluginManager.getInstance().resolveIntent(intent, null, 0);
80+
return info != null && PluginManager.getInstance().isPluginPackage(info.resolvePackageName);
81+
} catch (Exception e) {
82+
return false;
83+
}
84+
}
85+
6886
private void waitAndStart(final Intent forwordIntent) {
6987
new Thread() {
7088
@Override
7189
public void run() {
7290
try {
7391
PluginManager.getInstance().waitForConnected();
74-
startActivity(forwordIntent);
92+
if (isPlugin(forwordIntent)) {
93+
startActivity(forwordIntent);
94+
}
7595
} catch (Exception e) {
7696
e.printStackTrace();
7797
} finally {
@@ -90,14 +110,16 @@ private Intent getForwarIntent() {
90110
String intentUri = intent.getStringExtra(Env.EXTRA_TARGET_INTENT_URI);
91111
if (intentUri != null) {
92112
try {
93-
return Intent.parseUri(intentUri, 0);
113+
Intent res= Intent.parseUri(intentUri, 0);
114+
return res;
94115
} catch (URISyntaxException e) {
95116
}
96117
} else if (forwordIntent != null) {
97118
return forwordIntent;
98119
}
99120
}
100-
}catch (Exception e){}
121+
} catch (Exception e) {
122+
}
101123
return null;
102124
}
103125
}

0 commit comments

Comments
 (0)