Start reporting proper install/uninstall error messages

This commit is contained in:
Daniel Martí 2015-08-09 23:14:48 -07:00
parent 79b1396e4a
commit 816bd4b2e6
2 changed files with 34 additions and 17 deletions

View File

@ -295,8 +295,10 @@
<string name="root_access_denied_title">Root access denied</string>
<string name="root_access_denied_body">Either your Android device is not rooted or you have denied root access for F-Droid.</string>
<string name="update_all">Update all</string>
<string name="installer_error_title">(De-)Installation Error</string>
<string name="installer_error_body">The (de-)installation failed. If you are using F-Droid as a privileged app, try disabling this setting!</string>
<string name="install_error_title">Install error</string>
<string name="install_error_unknown">Failed to install due to an unknown error</string>
<string name="uninstall_error_title">Uninstall error</string>
<string name="uninstall_error_unknown">Failed to uninstall due to an unknown error</string>
<string name="system_permission_denied_title">System permissions denied</string>
<string name="system_permission_denied_body">This option is only available when F-Droid is installed as a privileged app.</string>
<string name="system_permission_install_via_root">Install as a privileged app</string>

View File

@ -1,5 +1,6 @@
/*
* Copyright (C) 2010-12 Ciaran Gultnieks, ciaran@ciarang.com
* Copyright (C) 2013-15 Daniel Martí <mvdan@mvdan.cc>
* Copyright (C) 2013 Stefan Völkel, bd@bc-bd.org
* Copyright (C) 2015 Nico Alt, nicoalt@posteo.org
*
@ -909,22 +910,36 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
onAppChanged();
}
});
} else {
runOnUiThread(new Runnable() {
@Override
public void run() {
onAppChanged();
Log.e(TAG, "Installer aborted with errorCode: " + errorCode);
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(AppDetails.this);
alertBuilder.setTitle(R.string.installer_error_title);
alertBuilder.setMessage(R.string.installer_error_title);
alertBuilder.setNeutralButton(android.R.string.ok, null);
alertBuilder.create().show();
}
});
return;
}
final int title, body;
if (operation == InstallerCallback.OPERATION_INSTALL) {
title = R.string.install_error_title;
} else {
title = R.string.uninstall_error_title;
}
switch (errorCode) {
default:
if (operation == InstallerCallback.OPERATION_INSTALL) {
body = R.string.install_error_unknown;
} else {
body = R.string.uninstall_error_unknown;
}
}
runOnUiThread(new Runnable() {
@Override
public void run() {
onAppChanged();
Log.e(TAG, "Installer aborted with errorCode: " + errorCode);
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(AppDetails.this);
alertBuilder.setTitle(title);
alertBuilder.setMessage(body);
alertBuilder.setNeutralButton(android.R.string.ok, null);
alertBuilder.create().show();
}
});
}
};