Merge branch 'restrict-priv-ext' into 'master'
Fixes for priv extension install For now, disable install of privileged extension on Android >=5.1 until we found better methods. Also, fix crash of dialogs on Android 6 using a workaround for transparent activities and some code simplifications. See merge request !259
This commit is contained in:
commit
90aa73dc40
@ -393,10 +393,10 @@
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".FDroid" />
|
||||
</activity>
|
||||
<!-- Note: Theme.NoDisplay, this activity shows dialogs only -->
|
||||
<!-- Note: AppThemeTransparent, this activity shows dialogs only -->
|
||||
<activity
|
||||
android:name=".privileged.install.InstallExtensionDialogActivity"
|
||||
android:theme="@android:style/Theme.NoDisplay" />
|
||||
android:theme="@style/AppThemeTransparent" />
|
||||
<receiver
|
||||
android:name=".privileged.install.InstallExtensionBootReceiver" >
|
||||
<intent-filter>
|
||||
|
@ -170,7 +170,7 @@ public abstract class Installer {
|
||||
*/
|
||||
public void installPackage(File apkFile, String packageName, String urlString)
|
||||
throws InstallFailedException {
|
||||
SanitizedFile apkToInstall = null;
|
||||
SanitizedFile apkToInstall;
|
||||
try {
|
||||
Map<String, Object> attributes = AndroidXMLDecompress.getManifestHeaderAttributes(apkFile.getAbsolutePath());
|
||||
|
||||
|
@ -206,6 +206,21 @@ public class InstallExtensionDialogActivity extends FragmentActivity {
|
||||
// hack to get theme applied (which is not automatically applied due to activity's Theme.NoDisplay
|
||||
ContextThemeWrapper theme = new ContextThemeWrapper(this, FDroidApp.getCurThemeResId());
|
||||
|
||||
// not support on Android >= 5.1
|
||||
if (android.os.Build.VERSION.SDK_INT >= 22) {
|
||||
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(theme);
|
||||
alertBuilder.setMessage(R.string.system_install_not_supported);
|
||||
alertBuilder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
InstallExtensionDialogActivity.this.setResult(Activity.RESULT_CANCELED);
|
||||
InstallExtensionDialogActivity.this.finish();
|
||||
}
|
||||
});
|
||||
alertBuilder.create().show();
|
||||
return;
|
||||
}
|
||||
|
||||
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(theme);
|
||||
alertBuilder.setTitle(R.string.system_install_question);
|
||||
String message = InstallExtension.create(getApplicationContext()).getWarningString();
|
||||
|
7
app/src/main/res/values-v23/styles.xml
Normal file
7
app/src/main/res/values-v23/styles.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<!-- see http://stackoverflow.com/questions/32169303/activity-did-not-call-finish-api-23 -->
|
||||
<style name="AppThemeTransparent" parent="@android:style/Theme.Translucent.NoTitleBar" />
|
||||
|
||||
</resources>
|
@ -295,6 +295,7 @@
|
||||
<string name="system_install_first_time_message">Looks like you have root access on your device. You can now install F-Droid Privileged Extension, tightly coupled with the Android operating system. This allows F-Droid to install, upgrade and uninstall apps on its own.</string>
|
||||
<string name="system_uninstall">Do you want to uninstall F-Droid Privileged Extension?</string>
|
||||
<string name="system_uninstall_button">Uninstall</string>
|
||||
<string name="system_install_not_supported">Installation of F-Droid Privileged Extension is currently not supported on Android 5.1 or later.</string>
|
||||
|
||||
<string name="swap_nfc_title">Touch to swap</string>
|
||||
<string name="swap_nfc_description">If your friend has F-Droid and NFC turned on touch your devices together.</string>
|
||||
|
@ -237,4 +237,6 @@
|
||||
</style>
|
||||
|
||||
<style name="AppDetailsSubheaderText" parent="AppDetailsSubheaderTextBase" />
|
||||
|
||||
<style name="AppThemeTransparent" parent="@android:style/Theme.NoDisplay" />
|
||||
</resources>
|
||||
|
Loading…
x
Reference in New Issue
Block a user