Better error handling for priv installer
This commit is contained in:
parent
4e8e148029
commit
592cd0424a
@ -576,8 +576,12 @@ public class AppDetails extends AppCompatActivity {
|
||||
if (!TextUtils.isEmpty(errorMessage)) {
|
||||
Log.e(TAG, "Installer aborted with errorMessage: " + errorMessage);
|
||||
|
||||
String title = String.format(
|
||||
getString(R.string.install_error_notify_title),
|
||||
app.name);
|
||||
|
||||
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(AppDetails.this);
|
||||
alertBuilder.setTitle(R.string.install_error_notify_title);
|
||||
alertBuilder.setTitle(title);
|
||||
alertBuilder.setMessage(errorMessage);
|
||||
alertBuilder.setNeutralButton(android.R.string.ok, null);
|
||||
alertBuilder.create().show();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Dominik Schürmann <dominik@dominikschuermann.de>
|
||||
* Copyright (C) 2014-2016 Dominik Schürmann <dominik@dominikschuermann.de>
|
||||
* Copyright (C) 2015 Daniel Martí <mvdan@mvdan.cc>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@ -39,6 +39,8 @@ import org.fdroid.fdroid.Utils;
|
||||
import org.fdroid.fdroid.privileged.IPrivilegedCallback;
|
||||
import org.fdroid.fdroid.privileged.IPrivilegedService;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* Installer based on using internal hidden APIs of the Android OS, which are
|
||||
* protected by the permissions
|
||||
@ -48,14 +50,8 @@ import org.fdroid.fdroid.privileged.IPrivilegedService;
|
||||
* </ul>
|
||||
* <p/>
|
||||
* Both permissions are protected by systemOrSignature (in newer versions:
|
||||
* system|signature) and only granted on F-Droid's install in the following
|
||||
* cases:
|
||||
* <ul>
|
||||
* <li>On all Android versions if F-Droid is pre-deployed as a
|
||||
* system-application with the Rom</li>
|
||||
* <li>On Android < 4.4 also when moved into /system/app/</li>
|
||||
* <li>On Android >= 4.4 also when moved into /system/priv-app/</li>
|
||||
* </ul>
|
||||
* system|signature). Thus, this installer works only when the "F-Droid Privileged
|
||||
* Extension" is installed into the system.
|
||||
* <p/>
|
||||
* Sources for Android 4.4 change:
|
||||
* https://groups.google.com/forum/#!msg/android-
|
||||
@ -75,6 +71,189 @@ public class PrivilegedInstaller extends Installer {
|
||||
public static final int IS_EXTENSION_INSTALLED_SIGNATURE_PROBLEM = 2;
|
||||
public static final int IS_EXTENSION_INSTALLED_PERMISSIONS_PROBLEM = 3;
|
||||
|
||||
// From AOSP source code
|
||||
public static final int ACTION_INSTALL_REPLACE_EXISTING = 2;
|
||||
|
||||
/**
|
||||
* Following return codes are copied from AOSP 5.1 source code
|
||||
*/
|
||||
public static final int INSTALL_SUCCEEDED = 1;
|
||||
public static final int INSTALL_FAILED_ALREADY_EXISTS = -1;
|
||||
public static final int INSTALL_FAILED_INVALID_APK = -2;
|
||||
public static final int INSTALL_FAILED_INVALID_URI = -3;
|
||||
public static final int INSTALL_FAILED_INSUFFICIENT_STORAGE = -4;
|
||||
public static final int INSTALL_FAILED_DUPLICATE_PACKAGE = -5;
|
||||
public static final int INSTALL_FAILED_NO_SHARED_USER = -6;
|
||||
public static final int INSTALL_FAILED_UPDATE_INCOMPATIBLE = -7;
|
||||
public static final int INSTALL_FAILED_SHARED_USER_INCOMPATIBLE = -8;
|
||||
public static final int INSTALL_FAILED_MISSING_SHARED_LIBRARY = -9;
|
||||
public static final int INSTALL_FAILED_REPLACE_COULDNT_DELETE = -10;
|
||||
public static final int INSTALL_FAILED_DEXOPT = -11;
|
||||
public static final int INSTALL_FAILED_OLDER_SDK = -12;
|
||||
public static final int INSTALL_FAILED_CONFLICTING_PROVIDER = -13;
|
||||
public static final int INSTALL_FAILED_NEWER_SDK = -14;
|
||||
public static final int INSTALL_FAILED_TEST_ONLY = -15;
|
||||
public static final int INSTALL_FAILED_CPU_ABI_INCOMPATIBLE = -16;
|
||||
public static final int INSTALL_FAILED_MISSING_FEATURE = -17;
|
||||
public static final int INSTALL_FAILED_CONTAINER_ERROR = -18;
|
||||
public static final int INSTALL_FAILED_INVALID_INSTALL_LOCATION = -19;
|
||||
public static final int INSTALL_FAILED_MEDIA_UNAVAILABLE = -20;
|
||||
public static final int INSTALL_FAILED_VERIFICATION_TIMEOUT = -21;
|
||||
public static final int INSTALL_FAILED_VERIFICATION_FAILURE = -22;
|
||||
public static final int INSTALL_FAILED_PACKAGE_CHANGED = -23;
|
||||
public static final int INSTALL_FAILED_UID_CHANGED = -24;
|
||||
public static final int INSTALL_FAILED_VERSION_DOWNGRADE = -25;
|
||||
public static final int INSTALL_PARSE_FAILED_NOT_APK = -100;
|
||||
public static final int INSTALL_PARSE_FAILED_BAD_MANIFEST = -101;
|
||||
public static final int INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION = -102;
|
||||
public static final int INSTALL_PARSE_FAILED_NO_CERTIFICATES = -103;
|
||||
public static final int INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES = -104;
|
||||
public static final int INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING = -105;
|
||||
public static final int INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME = -106;
|
||||
public static final int INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID = -107;
|
||||
public static final int INSTALL_PARSE_FAILED_MANIFEST_MALFORMED = -108;
|
||||
public static final int INSTALL_PARSE_FAILED_MANIFEST_EMPTY = -109;
|
||||
public static final int INSTALL_FAILED_INTERNAL_ERROR = -110;
|
||||
public static final int INSTALL_FAILED_USER_RESTRICTED = -111;
|
||||
public static final int INSTALL_FAILED_DUPLICATE_PERMISSION = -112;
|
||||
public static final int INSTALL_FAILED_NO_MATCHING_ABIS = -113;
|
||||
/**
|
||||
* Internal return code for NativeLibraryHelper methods to indicate that the package
|
||||
* being processed did not contain any native code. This is placed here only so that
|
||||
* it can belong to the same value space as the other install failure codes.
|
||||
*/
|
||||
public static final int NO_NATIVE_LIBRARIES = -114;
|
||||
public static final int INSTALL_FAILED_ABORTED = -115;
|
||||
|
||||
private static final HashMap<Integer, String> sInstallReturnCodes;
|
||||
|
||||
static {
|
||||
// Descriptions extracted from the source code comments in AOSP
|
||||
sInstallReturnCodes = new HashMap<>();
|
||||
sInstallReturnCodes.put(INSTALL_SUCCEEDED,
|
||||
"Success");
|
||||
sInstallReturnCodes.put(INSTALL_FAILED_ALREADY_EXISTS,
|
||||
"Package is already installed.");
|
||||
sInstallReturnCodes.put(INSTALL_FAILED_INVALID_APK,
|
||||
"The package archive file is invalid.");
|
||||
sInstallReturnCodes.put(INSTALL_FAILED_INVALID_URI,
|
||||
"The URI passed in is invalid.");
|
||||
sInstallReturnCodes.put(INSTALL_FAILED_INSUFFICIENT_STORAGE,
|
||||
"The package manager service found that the device didn't have enough " +
|
||||
"storage space to install the app.");
|
||||
sInstallReturnCodes.put(INSTALL_FAILED_DUPLICATE_PACKAGE,
|
||||
"A package is already installed with the same name.");
|
||||
sInstallReturnCodes.put(INSTALL_FAILED_NO_SHARED_USER,
|
||||
"The requested shared user does not exist.");
|
||||
sInstallReturnCodes.put(INSTALL_FAILED_UPDATE_INCOMPATIBLE,
|
||||
"A previously installed package of the same name has a different signature than " +
|
||||
"the new package (and the old package's data was not removed).");
|
||||
sInstallReturnCodes.put(INSTALL_FAILED_SHARED_USER_INCOMPATIBLE,
|
||||
"The new package is requested a shared user which is already installed on " +
|
||||
"the device and does not have matching signature.");
|
||||
sInstallReturnCodes.put(INSTALL_FAILED_MISSING_SHARED_LIBRARY,
|
||||
"The new package uses a shared library that is not available.");
|
||||
sInstallReturnCodes.put(INSTALL_FAILED_REPLACE_COULDNT_DELETE,
|
||||
"Unknown"); // wrong comment in source
|
||||
sInstallReturnCodes.put(INSTALL_FAILED_DEXOPT,
|
||||
"The package failed while optimizing and validating its dex files, either " +
|
||||
"because there was not enough storage or the validation failed.");
|
||||
sInstallReturnCodes.put(INSTALL_FAILED_OLDER_SDK,
|
||||
"The new package failed because the current SDK version is older than that " +
|
||||
"required by the package.");
|
||||
sInstallReturnCodes.put(INSTALL_FAILED_CONFLICTING_PROVIDER,
|
||||
"The new package failed because it contains a content provider with the same " +
|
||||
"authority as a provider already installed in the system.");
|
||||
sInstallReturnCodes.put(INSTALL_FAILED_NEWER_SDK,
|
||||
"The new package failed because the current SDK version is newer than that " +
|
||||
"required by the package.");
|
||||
sInstallReturnCodes.put(INSTALL_FAILED_TEST_ONLY,
|
||||
"The new package failed because it has specified that it is a test-only package " +
|
||||
"and the caller has not supplied the {@link #INSTALL_ALLOW_TEST} flag.");
|
||||
sInstallReturnCodes.put(INSTALL_FAILED_CPU_ABI_INCOMPATIBLE,
|
||||
"The package being installed contains native code, but none that is compatible " +
|
||||
"with the device's CPU_ABI.");
|
||||
sInstallReturnCodes.put(INSTALL_FAILED_MISSING_FEATURE,
|
||||
"The new package uses a feature that is not available.");
|
||||
sInstallReturnCodes.put(INSTALL_FAILED_CONTAINER_ERROR,
|
||||
"A secure container mount point couldn't be accessed on external media.");
|
||||
sInstallReturnCodes.put(INSTALL_FAILED_INVALID_INSTALL_LOCATION,
|
||||
"The new package couldn't be installed in the specified install location.");
|
||||
sInstallReturnCodes.put(INSTALL_FAILED_MEDIA_UNAVAILABLE,
|
||||
"The new package couldn't be installed in the specified install location " +
|
||||
"because the media is not available.");
|
||||
sInstallReturnCodes.put(INSTALL_FAILED_VERIFICATION_TIMEOUT,
|
||||
"The new package couldn't be installed because the verification timed out.");
|
||||
sInstallReturnCodes.put(INSTALL_FAILED_VERIFICATION_FAILURE,
|
||||
"The new package couldn't be installed because the verification did not succeed.");
|
||||
sInstallReturnCodes.put(INSTALL_FAILED_PACKAGE_CHANGED,
|
||||
"The package changed from what the calling program expected.");
|
||||
sInstallReturnCodes.put(INSTALL_FAILED_UID_CHANGED,
|
||||
"The new package is assigned a different UID than it previously held.");
|
||||
sInstallReturnCodes.put(INSTALL_FAILED_VERSION_DOWNGRADE,
|
||||
"The new package has an older version code than the currently installed package.");
|
||||
sInstallReturnCodes.put(INSTALL_PARSE_FAILED_NOT_APK,
|
||||
"The parser was given a path that is not a file, or does not end with the " +
|
||||
"expected '.apk' extension.");
|
||||
sInstallReturnCodes.put(INSTALL_PARSE_FAILED_BAD_MANIFEST,
|
||||
"the parser was unable to retrieve the AndroidManifest.xml file.");
|
||||
sInstallReturnCodes.put(INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION,
|
||||
"The parser encountered an unexpected exception.");
|
||||
sInstallReturnCodes.put(INSTALL_PARSE_FAILED_NO_CERTIFICATES,
|
||||
"The parser did not find any certificates in the .apk.");
|
||||
sInstallReturnCodes.put(INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES,
|
||||
"The parser found inconsistent certificates on the files in the .apk.");
|
||||
sInstallReturnCodes.put(INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING,
|
||||
"The parser encountered a CertificateEncodingException in one of the files in " +
|
||||
"the .apk.");
|
||||
sInstallReturnCodes.put(INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME,
|
||||
"The parser encountered a bad or missing package name in the manifest.");
|
||||
sInstallReturnCodes.put(INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID,
|
||||
"The parser encountered a bad shared user id name in the manifest.");
|
||||
sInstallReturnCodes.put(INSTALL_PARSE_FAILED_MANIFEST_MALFORMED,
|
||||
"The parser encountered some structural problem in the manifest.");
|
||||
sInstallReturnCodes.put(INSTALL_PARSE_FAILED_MANIFEST_EMPTY,
|
||||
"The parser did not find any actionable tags (instrumentation or application) " +
|
||||
"in the manifest.");
|
||||
sInstallReturnCodes.put(INSTALL_FAILED_INTERNAL_ERROR,
|
||||
"The system failed to install the package because of system issues.");
|
||||
sInstallReturnCodes.put(INSTALL_FAILED_USER_RESTRICTED,
|
||||
"The system failed to install the package because the user is restricted from " +
|
||||
"installing apps.");
|
||||
sInstallReturnCodes.put(INSTALL_FAILED_DUPLICATE_PERMISSION,
|
||||
"The system failed to install the package because it is attempting to define a " +
|
||||
"permission that is already defined by some existing package.");
|
||||
sInstallReturnCodes.put(INSTALL_FAILED_NO_MATCHING_ABIS,
|
||||
"The system failed to install the package because its packaged native code did " +
|
||||
"not match any of the ABIs supported by the system.");
|
||||
}
|
||||
|
||||
public static final int DELETE_SUCCEEDED = 1;
|
||||
public static final int DELETE_FAILED_INTERNAL_ERROR = -1;
|
||||
public static final int DELETE_FAILED_DEVICE_POLICY_MANAGER = -2;
|
||||
public static final int DELETE_FAILED_USER_RESTRICTED = -3;
|
||||
public static final int DELETE_FAILED_OWNER_BLOCKED = -4;
|
||||
public static final int DELETE_FAILED_ABORTED = -5;
|
||||
|
||||
private static final HashMap<Integer, String> sUninstallReturnCodes;
|
||||
|
||||
static {
|
||||
// Descriptions extrgacted from the source code comments in AOSP
|
||||
sUninstallReturnCodes = new HashMap<>();
|
||||
sUninstallReturnCodes.put(DELETE_SUCCEEDED,
|
||||
"Success");
|
||||
sUninstallReturnCodes.put(DELETE_FAILED_INTERNAL_ERROR,
|
||||
" the system failed to delete the package for an unspecified reason.");
|
||||
sUninstallReturnCodes.put(DELETE_FAILED_DEVICE_POLICY_MANAGER,
|
||||
"the system failed to delete the package because it is the active " +
|
||||
"DevicePolicy manager.");
|
||||
sUninstallReturnCodes.put(DELETE_FAILED_USER_RESTRICTED,
|
||||
"the system failed to delete the package since the user is restricted.");
|
||||
sUninstallReturnCodes.put(DELETE_FAILED_OWNER_BLOCKED,
|
||||
"the system failed to delete the package because a profile or " +
|
||||
"device owner has marked the package as uninstallable.");
|
||||
}
|
||||
|
||||
public PrivilegedInstaller(Context context) {
|
||||
super(context);
|
||||
}
|
||||
@ -163,22 +342,23 @@ public class PrivilegedInstaller extends Installer {
|
||||
IPrivilegedCallback callback = new IPrivilegedCallback.Stub() {
|
||||
@Override
|
||||
public void handleResult(String packageName, int returnCode) throws RemoteException {
|
||||
// TODO: propagate other return codes!
|
||||
if (returnCode == INSTALL_SUCCEEDED) {
|
||||
Utils.debugLog(TAG, "Install succeeded");
|
||||
sendBroadcastInstall(uri, originatingUri, ACTION_INSTALL_COMPLETE);
|
||||
} else {
|
||||
Log.e(TAG, "Install failed with returnCode " + returnCode);
|
||||
sendBroadcastInstall(uri, originatingUri, ACTION_INSTALL_INTERRUPTED,
|
||||
"Install failed with returnCode " + returnCode);
|
||||
"Error " + returnCode + ": "
|
||||
+ sInstallReturnCodes.get(returnCode));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
privService.installPackage(sanitizedUri, INSTALL_REPLACE_EXISTING, null, callback);
|
||||
privService.installPackage(sanitizedUri, ACTION_INSTALL_REPLACE_EXISTING,
|
||||
null, callback);
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "RemoteException", e);
|
||||
sendBroadcastInstall(uri, originatingUri, ACTION_INSTALL_INTERRUPTED,
|
||||
"connecting to privileged service failed");
|
||||
}
|
||||
}
|
||||
|
||||
@ -257,14 +437,12 @@ public class PrivilegedInstaller extends Installer {
|
||||
IPrivilegedCallback callback = new IPrivilegedCallback.Stub() {
|
||||
@Override
|
||||
public void handleResult(String packageName, int returnCode) throws RemoteException {
|
||||
// TODO: propagate other return codes?
|
||||
if (returnCode == DELETE_SUCCEEDED) {
|
||||
Utils.debugLog(TAG, "Delete succeeded");
|
||||
sendBroadcastUninstall(packageName, ACTION_UNINSTALL_COMPLETE);
|
||||
} else {
|
||||
Log.e(TAG, "Delete failed with returnCode " + returnCode);
|
||||
sendBroadcastUninstall(packageName, ACTION_UNINSTALL_INTERRUPTED,
|
||||
"Uninstall failed with returnCode " + returnCode);
|
||||
"Error " + returnCode + ": "
|
||||
+ sUninstallReturnCodes.get(returnCode));
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -273,6 +451,8 @@ public class PrivilegedInstaller extends Installer {
|
||||
privService.deletePackage(packageName, 0, callback);
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "RemoteException", e);
|
||||
sendBroadcastUninstall(packageName, ACTION_UNINSTALL_INTERRUPTED,
|
||||
"connecting to privileged service failed");
|
||||
}
|
||||
}
|
||||
|
||||
@ -314,360 +494,5 @@ public class PrivilegedInstaller extends Installer {
|
||||
// }
|
||||
// }
|
||||
|
||||
public static final int INSTALL_REPLACE_EXISTING = 2;
|
||||
|
||||
/**
|
||||
* Following return codes are copied from Android 5.1 source code
|
||||
*/
|
||||
|
||||
/**
|
||||
* Installation return code: this is passed to the {@link IPackageInstallObserver} by
|
||||
* {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} on success.
|
||||
*/
|
||||
public static final int INSTALL_SUCCEEDED = 1;
|
||||
|
||||
/**
|
||||
* Installation return code: this is passed to the {@link IPackageInstallObserver} by
|
||||
* {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the package is
|
||||
* already installed.
|
||||
*/
|
||||
public static final int INSTALL_FAILED_ALREADY_EXISTS = -1;
|
||||
|
||||
/**
|
||||
* Installation return code: this is passed to the {@link IPackageInstallObserver} by
|
||||
* {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the package archive
|
||||
* file is invalid.
|
||||
*/
|
||||
public static final int INSTALL_FAILED_INVALID_APK = -2;
|
||||
|
||||
/**
|
||||
* Installation return code: this is passed to the {@link IPackageInstallObserver} by
|
||||
* {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the URI passed in
|
||||
* is invalid.
|
||||
*/
|
||||
public static final int INSTALL_FAILED_INVALID_URI = -3;
|
||||
|
||||
/**
|
||||
* Installation return code: this is passed to the {@link IPackageInstallObserver} by
|
||||
* {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the package manager
|
||||
* service found that the device didn't have enough storage space to install the app.
|
||||
*/
|
||||
public static final int INSTALL_FAILED_INSUFFICIENT_STORAGE = -4;
|
||||
|
||||
/**
|
||||
* Installation return code: this is passed to the {@link IPackageInstallObserver} by
|
||||
* {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if a
|
||||
* package is already installed with the same name.
|
||||
*/
|
||||
public static final int INSTALL_FAILED_DUPLICATE_PACKAGE = -5;
|
||||
|
||||
/**
|
||||
* Installation return code: this is passed to the {@link IPackageInstallObserver} by
|
||||
* {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
|
||||
* the requested shared user does not exist.
|
||||
*/
|
||||
public static final int INSTALL_FAILED_NO_SHARED_USER = -6;
|
||||
|
||||
/**
|
||||
* Installation return code: this is passed to the {@link IPackageInstallObserver} by
|
||||
* {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
|
||||
* a previously installed package of the same name has a different signature
|
||||
* than the new package (and the old package's data was not removed).
|
||||
*/
|
||||
public static final int INSTALL_FAILED_UPDATE_INCOMPATIBLE = -7;
|
||||
|
||||
/**
|
||||
* Installation return code: this is passed to the {@link IPackageInstallObserver} by
|
||||
* {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
|
||||
* the new package is requested a shared user which is already installed on the
|
||||
* device and does not have matching signature.
|
||||
*/
|
||||
public static final int INSTALL_FAILED_SHARED_USER_INCOMPATIBLE = -8;
|
||||
|
||||
/**
|
||||
* Installation return code: this is passed to the {@link IPackageInstallObserver} by
|
||||
* {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
|
||||
* the new package uses a shared library that is not available.
|
||||
*/
|
||||
public static final int INSTALL_FAILED_MISSING_SHARED_LIBRARY = -9;
|
||||
|
||||
/**
|
||||
* Installation return code: this is passed to the {@link IPackageInstallObserver} by
|
||||
* {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
|
||||
* the new package uses a shared library that is not available.
|
||||
*/
|
||||
public static final int INSTALL_FAILED_REPLACE_COULDNT_DELETE = -10;
|
||||
|
||||
/**
|
||||
* Installation return code: this is passed to the {@link IPackageInstallObserver} by
|
||||
* {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
|
||||
* the new package failed while optimizing and validating its dex files,
|
||||
* either because there was not enough storage or the validation failed.
|
||||
*/
|
||||
public static final int INSTALL_FAILED_DEXOPT = -11;
|
||||
|
||||
/**
|
||||
* Installation return code: this is passed to the {@link IPackageInstallObserver} by
|
||||
* {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
|
||||
* the new package failed because the current SDK version is older than
|
||||
* that required by the package.
|
||||
*/
|
||||
public static final int INSTALL_FAILED_OLDER_SDK = -12;
|
||||
|
||||
/**
|
||||
* Installation return code: this is passed to the {@link IPackageInstallObserver} by
|
||||
* {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
|
||||
* the new package failed because it contains a content provider with the
|
||||
* same authority as a provider already installed in the system.
|
||||
*/
|
||||
public static final int INSTALL_FAILED_CONFLICTING_PROVIDER = -13;
|
||||
|
||||
/**
|
||||
* Installation return code: this is passed to the {@link IPackageInstallObserver} by
|
||||
* {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
|
||||
* the new package failed because the current SDK version is newer than
|
||||
* that required by the package.
|
||||
*/
|
||||
public static final int INSTALL_FAILED_NEWER_SDK = -14;
|
||||
|
||||
/**
|
||||
* Installation return code: this is passed to the {@link IPackageInstallObserver} by
|
||||
* {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
|
||||
* the new package failed because it has specified that it is a test-only
|
||||
* package and the caller has not supplied the {@link #INSTALL_ALLOW_TEST}
|
||||
* flag.
|
||||
*/
|
||||
public static final int INSTALL_FAILED_TEST_ONLY = -15;
|
||||
|
||||
/**
|
||||
* Installation return code: this is passed to the {@link IPackageInstallObserver} by
|
||||
* {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
|
||||
* the package being installed contains native code, but none that is
|
||||
* compatible with the device's CPU_ABI.
|
||||
*/
|
||||
public static final int INSTALL_FAILED_CPU_ABI_INCOMPATIBLE = -16;
|
||||
|
||||
/**
|
||||
* Installation return code: this is passed to the {@link IPackageInstallObserver} by
|
||||
* {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
|
||||
* the new package uses a feature that is not available.
|
||||
*/
|
||||
public static final int INSTALL_FAILED_MISSING_FEATURE = -17;
|
||||
|
||||
// ------ Errors related to sdcard
|
||||
/**
|
||||
* Installation return code: this is passed to the {@link IPackageInstallObserver} by
|
||||
* {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
|
||||
* a secure container mount point couldn't be accessed on external media.
|
||||
*/
|
||||
public static final int INSTALL_FAILED_CONTAINER_ERROR = -18;
|
||||
|
||||
/**
|
||||
* Installation return code: this is passed to the {@link IPackageInstallObserver} by
|
||||
* {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
|
||||
* the new package couldn't be installed in the specified install
|
||||
* location.
|
||||
*/
|
||||
public static final int INSTALL_FAILED_INVALID_INSTALL_LOCATION = -19;
|
||||
|
||||
/**
|
||||
* Installation return code: this is passed to the {@link IPackageInstallObserver} by
|
||||
* {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
|
||||
* the new package couldn't be installed in the specified install
|
||||
* location because the media is not available.
|
||||
*/
|
||||
public static final int INSTALL_FAILED_MEDIA_UNAVAILABLE = -20;
|
||||
|
||||
/**
|
||||
* Installation return code: this is passed to the {@link IPackageInstallObserver} by
|
||||
* {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
|
||||
* the new package couldn't be installed because the verification timed out.
|
||||
*/
|
||||
public static final int INSTALL_FAILED_VERIFICATION_TIMEOUT = -21;
|
||||
|
||||
/**
|
||||
* Installation return code: this is passed to the {@link IPackageInstallObserver} by
|
||||
* {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
|
||||
* the new package couldn't be installed because the verification did not succeed.
|
||||
*/
|
||||
public static final int INSTALL_FAILED_VERIFICATION_FAILURE = -22;
|
||||
|
||||
/**
|
||||
* Installation return code: this is passed to the {@link IPackageInstallObserver} by
|
||||
* {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
|
||||
* the package changed from what the calling program expected.
|
||||
*/
|
||||
public static final int INSTALL_FAILED_PACKAGE_CHANGED = -23;
|
||||
|
||||
/**
|
||||
* Installation return code: this is passed to the {@link IPackageInstallObserver} by
|
||||
* {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
|
||||
* the new package is assigned a different UID than it previously held.
|
||||
*/
|
||||
public static final int INSTALL_FAILED_UID_CHANGED = -24;
|
||||
|
||||
/**
|
||||
* Installation return code: this is passed to the {@link IPackageInstallObserver} by
|
||||
* {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
|
||||
* the new package has an older version code than the currently installed package.
|
||||
*/
|
||||
public static final int INSTALL_FAILED_VERSION_DOWNGRADE = -25;
|
||||
|
||||
/**
|
||||
* Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
|
||||
* {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
|
||||
* if the parser was given a path that is not a file, or does not end with the expected
|
||||
* '.apk' extension.
|
||||
*/
|
||||
public static final int INSTALL_PARSE_FAILED_NOT_APK = -100;
|
||||
|
||||
/**
|
||||
* Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
|
||||
* {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
|
||||
* if the parser was unable to retrieve the AndroidManifest.xml file.
|
||||
*/
|
||||
public static final int INSTALL_PARSE_FAILED_BAD_MANIFEST = -101;
|
||||
|
||||
/**
|
||||
* Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
|
||||
* {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
|
||||
* if the parser encountered an unexpected exception.
|
||||
*/
|
||||
public static final int INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION = -102;
|
||||
|
||||
/**
|
||||
* Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
|
||||
* {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
|
||||
* if the parser did not find any certificates in the .apk.
|
||||
*/
|
||||
public static final int INSTALL_PARSE_FAILED_NO_CERTIFICATES = -103;
|
||||
|
||||
/**
|
||||
* Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
|
||||
* {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
|
||||
* if the parser found inconsistent certificates on the files in the .apk.
|
||||
*/
|
||||
public static final int INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES = -104;
|
||||
|
||||
/**
|
||||
* Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
|
||||
* {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
|
||||
* if the parser encountered a CertificateEncodingException in one of the
|
||||
* files in the .apk.
|
||||
*/
|
||||
public static final int INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING = -105;
|
||||
|
||||
/**
|
||||
* Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
|
||||
* {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
|
||||
* if the parser encountered a bad or missing package name in the manifest.
|
||||
*/
|
||||
public static final int INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME = -106;
|
||||
|
||||
/**
|
||||
* Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
|
||||
* {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
|
||||
* if the parser encountered a bad shared user id name in the manifest.
|
||||
*/
|
||||
public static final int INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID = -107;
|
||||
|
||||
/**
|
||||
* Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
|
||||
* {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
|
||||
* if the parser encountered some structural problem in the manifest.
|
||||
*/
|
||||
public static final int INSTALL_PARSE_FAILED_MANIFEST_MALFORMED = -108;
|
||||
|
||||
/**
|
||||
* Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
|
||||
* {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
|
||||
* if the parser did not find any actionable tags (instrumentation or application)
|
||||
* in the manifest.
|
||||
*/
|
||||
public static final int INSTALL_PARSE_FAILED_MANIFEST_EMPTY = -109;
|
||||
|
||||
/**
|
||||
* Installation failed return code: this is passed to the {@link IPackageInstallObserver} by
|
||||
* {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
|
||||
* if the system failed to install the package because of system issues.
|
||||
*/
|
||||
public static final int INSTALL_FAILED_INTERNAL_ERROR = -110;
|
||||
|
||||
/**
|
||||
* Installation failed return code: this is passed to the {@link IPackageInstallObserver} by
|
||||
* {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
|
||||
* if the system failed to install the package because the user is restricted from installing
|
||||
* apps.
|
||||
*/
|
||||
public static final int INSTALL_FAILED_USER_RESTRICTED = -111;
|
||||
|
||||
/**
|
||||
* Installation failed return code: this is passed to the {@link IPackageInstallObserver} by
|
||||
* {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
|
||||
* if the system failed to install the package because it is attempting to define a
|
||||
* permission that is already defined by some existing package.
|
||||
* <p/>
|
||||
* The package name of the app which has already defined the permission is passed to
|
||||
* a {@link PackageInstallObserver}, if any, as the {@link #EXTRA_EXISTING_PACKAGE}
|
||||
* string extra; and the name of the permission being redefined is passed in the
|
||||
* {@link #EXTRA_EXISTING_PERMISSION} string extra.
|
||||
*/
|
||||
public static final int INSTALL_FAILED_DUPLICATE_PERMISSION = -112;
|
||||
|
||||
/**
|
||||
* Installation failed return code: this is passed to the {@link IPackageInstallObserver} by
|
||||
* {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
|
||||
* if the system failed to install the package because its packaged native code did not
|
||||
* match any of the ABIs supported by the system.
|
||||
*/
|
||||
public static final int INSTALL_FAILED_NO_MATCHING_ABIS = -113;
|
||||
|
||||
/**
|
||||
* Internal return code for NativeLibraryHelper methods to indicate that the package
|
||||
* being processed did not contain any native code. This is placed here only so that
|
||||
* it can belong to the same value space as the other install failure codes.
|
||||
*/
|
||||
public static final int NO_NATIVE_LIBRARIES = -114;
|
||||
|
||||
public static final int INSTALL_FAILED_ABORTED = -115;
|
||||
|
||||
/**
|
||||
* Return code for when package deletion succeeds. This is passed to the
|
||||
* {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system
|
||||
* succeeded in deleting the package.
|
||||
*/
|
||||
public static final int DELETE_SUCCEEDED = 1;
|
||||
|
||||
/**
|
||||
* Deletion failed return code: this is passed to the
|
||||
* {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system
|
||||
* failed to delete the package for an unspecified reason.
|
||||
*/
|
||||
public static final int DELETE_FAILED_INTERNAL_ERROR = -1;
|
||||
|
||||
/**
|
||||
* Deletion failed return code: this is passed to the
|
||||
* {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system
|
||||
* failed to delete the package because it is the active DevicePolicy
|
||||
* manager.
|
||||
*/
|
||||
public static final int DELETE_FAILED_DEVICE_POLICY_MANAGER = -2;
|
||||
|
||||
/**
|
||||
* Deletion failed return code: this is passed to the
|
||||
* {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system
|
||||
* failed to delete the package since the user is restricted.
|
||||
*/
|
||||
public static final int DELETE_FAILED_USER_RESTRICTED = -3;
|
||||
|
||||
/**
|
||||
* Deletion failed return code: this is passed to the
|
||||
* {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system
|
||||
* failed to delete the package because a profile
|
||||
* or device owner has marked the package as uninstallable.
|
||||
*/
|
||||
public static final int DELETE_FAILED_OWNER_BLOCKED = -4;
|
||||
|
||||
public static final int DELETE_FAILED_ABORTED = -5;
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user