Skip to content

Commit 501dedb

Browse files
committed
REMOVE: The embedded dummy-auto APK in assets, with web link used instead.
1 parent b4689cd commit 501dedb

File tree

4 files changed

+13
-61
lines changed

4 files changed

+13
-61
lines changed

src/main/AndroidManifest.xml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
1919
package="com.oasisfeng.nevo.decorators.wechat" android:versionCode="21000" android:versionName="2.1">
2020

21-
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
22-
2321
<application android:label="@string/decorator_wechat_label" android:allowBackup="true" android:icon="@mipmap/ic_launcher"
2422
android:directBootAware="true" tools:targetApi="N" tools:ignore="GoogleAppIndexingWarning">
2523

@@ -54,12 +52,6 @@
5452
</intent-filter>
5553
</activity>
5654

57-
<provider android:name=".AssetFileProvider"
58-
android:authorities="com.oasisfeng.nevo.decorators.wechat.files"
59-
android:grantUriPermissions="true"
60-
android:process=":ui"
61-
android:exported="false" />
62-
6355
</application>
6456

6557
</manifest>

src/main/assets/dummy-auto.apk

-8.2 KB
Binary file not shown.

src/main/java/com/oasisfeng/nevo/decorators/wechat/AssetFileProvider.java

Lines changed: 0 additions & 41 deletions
This file was deleted.

src/main/java/com/oasisfeng/nevo/decorators/wechat/WeChatDecoratorSettingsActivity.java

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@
1717

1818
import androidx.annotation.Nullable;
1919

20-
import static android.content.Intent.ACTION_INSTALL_PACKAGE;
21-
import static android.content.Intent.FLAG_GRANT_READ_URI_PERMISSION;
2220
import static com.oasisfeng.nevo.decorators.wechat.WeChatDecorator.WECHAT_PACKAGE;
21+
import static java.util.Objects.requireNonNull;
2322

2423
/**
2524
* Entry activity. Some ROMs (including Samsung, OnePlus) require a launcher activity to allow any component being bound by other app.
@@ -69,7 +68,7 @@ public class WeChatDecoratorSettingsActivity extends PreferenceActivity {
6968
preference_extension.setSelectable(! android_auto_installed);
7069
preference_extension.setSummary(android_auto_installed ? R.string.pref_extension_summary_installed
7170
: isPlayStoreSystemApp() ? R.string.pref_extension_summary_auto : R.string.pref_extension_summary);
72-
preference_extension.setOnPreferenceClickListener(android_auto_installed ? null : this::installExtension);
71+
preference_extension.setOnPreferenceClickListener(android_auto_installed ? null : this::redirectToExtensionPageOnline);
7372

7473
@SuppressWarnings("deprecation") final Preference preference_version = findPreference(getString(R.string.pref_version));
7574
try {
@@ -81,7 +80,7 @@ public class WeChatDecoratorSettingsActivity extends PreferenceActivity {
8180
preference_extension.setEnabled(true);
8281
preference_extension.setSelectable(true);
8382
preference_extension.setSummary(R.string.pref_extension_summary);
84-
preference_extension.setOnPreferenceClickListener(this::installExtension);
83+
preference_extension.setOnPreferenceClickListener(this::redirectToExtensionPageOnline);
8584
}
8685
return true;
8786
});
@@ -90,7 +89,7 @@ public class WeChatDecoratorSettingsActivity extends PreferenceActivity {
9089
private boolean installNevolution(final @SuppressWarnings("unused") Preference preference) {
9190
try {
9291
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(APP_MARKET_PREFIX + NEVOLUTION_PACKAGE)));
93-
} catch (final ActivityNotFoundException e) {} // TODO: Landing web page
92+
} catch (final ActivityNotFoundException ignored) {} // TODO: Landing web page
9493
return true;
9594
}
9695

@@ -105,13 +104,15 @@ private boolean activate(final @SuppressWarnings("unused") Preference preference
105104
return true;
106105
}
107106

108-
private boolean installExtension(final @SuppressWarnings("unused") Preference preference) {
109-
if (mVersionClickCount > 0 && isPlayStoreSystemApp())
110-
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(APP_MARKET_PREFIX + ANDROID_AUTO_PACKAGE)).setPackage(PLAY_STORE_PACKAGE));
111-
else try {
112-
final String authority = getPackageManager().getProviderInfo(new ComponentName(this, AssetFileProvider.class), 0).authority;
113-
startActivity(new Intent(ACTION_INSTALL_PACKAGE, Uri.parse("content://" + authority + "/dummy-auto.apk")).addFlags(FLAG_GRANT_READ_URI_PERMISSION));
114-
} catch (final PackageManager.NameNotFoundException | ActivityNotFoundException ignored) {} // Should never happen
107+
private boolean redirectToExtensionPageOnline(@SuppressWarnings("unused") final Preference preference) {
108+
final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/Nevolution/decorator-wechat"));
109+
try {
110+
startActivity(intent);
111+
} catch (final ActivityNotFoundException e) {
112+
try {
113+
startActivity(intent.setData(requireNonNull(intent.getData()).buildUpon().scheme("http").build()));
114+
} catch (final ActivityNotFoundException ignored) {}
115+
}
115116
return true;
116117
}
117118

0 commit comments

Comments
 (0)