Java Code Examples for android.content.pm.PackageInstaller#STATUS_FAILURE_CONFLICT
The following examples show how to use
android.content.pm.PackageInstaller#STATUS_FAILURE_CONFLICT .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RootlessSaiPiBroadcastReceiver.java From SAI with GNU General Public License v3.0 | 5 votes |
public String getSimplifiedErrorDescription(int status, String blockingPackage) { switch (status) { case PackageInstaller.STATUS_FAILURE_ABORTED: return mContext.getString(R.string.installer_error_aborted); case PackageInstaller.STATUS_FAILURE_BLOCKED: String blocker = mContext.getString(R.string.installer_error_blocked_device); if (blockingPackage != null) { String appLabel = Utils.getAppLabel(mContext, blockingPackage); if (appLabel != null) blocker = appLabel; } return mContext.getString(R.string.installer_error_blocked, blocker); case PackageInstaller.STATUS_FAILURE_CONFLICT: return mContext.getString(R.string.installer_error_conflict); case PackageInstaller.STATUS_FAILURE_INCOMPATIBLE: return mContext.getString(R.string.installer_error_incompatible); case PackageInstaller.STATUS_FAILURE_INVALID: return mContext.getString(R.string.installer_error_bad_apks); case PackageInstaller.STATUS_FAILURE_STORAGE: return mContext.getString(R.string.installer_error_storage); case STATUS_BAD_ROM: return mContext.getString(R.string.installer_error_lidl_rom); } return mContext.getString(R.string.installer_error_generic); }
Example 2
Source File: RootlessSAIPIService.java From SAI with GNU General Public License v3.0 | 5 votes |
public String getErrorString(int status, String blockingPackage) { switch (status) { case PackageInstaller.STATUS_FAILURE_ABORTED: return getString(R.string.installer_error_aborted); case PackageInstaller.STATUS_FAILURE_BLOCKED: String blocker = getString(R.string.installer_error_blocked_device); if (blockingPackage != null) { String appLabel = Utils.getAppLabel(getApplicationContext(), blockingPackage); if (appLabel != null) blocker = appLabel; } return getString(R.string.installer_error_blocked, blocker); case PackageInstaller.STATUS_FAILURE_CONFLICT: return getString(R.string.installer_error_conflict); case PackageInstaller.STATUS_FAILURE_INCOMPATIBLE: return getString(R.string.installer_error_incompatible); case PackageInstaller.STATUS_FAILURE_INVALID: return getString(R.string.installer_error_bad_apks); case PackageInstaller.STATUS_FAILURE_STORAGE: return getString(R.string.installer_error_storage); } return getString(R.string.installer_error_generic); }
Example 3
Source File: InstallResultReceiver.java From aptoide-client-v8 with GNU General Public License v3.0 | 5 votes |
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override public void onReceive(Context context, Intent intent) { Bundle extras = intent.getExtras(); if (extras != null && INSTALL_SESSION_API_COMPLETE_ACTION.equals(intent.getAction())) { int status = extras.getInt(PackageInstaller.EXTRA_STATUS); String message = extras.getString(PackageInstaller.EXTRA_STATUS_MESSAGE); String packageName = extras.getString(PackageInstaller.EXTRA_PACKAGE_NAME); switch (status) { case PackageInstaller.STATUS_PENDING_USER_ACTION: packageInstallerResultCallback.onPendingUserAction(extras); break; case PackageInstaller.STATUS_SUCCESS: packageInstallerResultCallback.onInstallationResult( new InstallStatus(InstallStatus.Status.SUCCESS, "Install succeeded", packageName)); break; case PackageInstaller.STATUS_FAILURE: case PackageInstaller.STATUS_FAILURE_BLOCKED: case PackageInstaller.STATUS_FAILURE_CONFLICT: case PackageInstaller.STATUS_FAILURE_INCOMPATIBLE: case PackageInstaller.STATUS_FAILURE_INVALID: case PackageInstaller.STATUS_FAILURE_STORAGE: packageInstallerResultCallback.onInstallationResult( new InstallStatus(InstallStatus.Status.FAIL, "Install failed " + status + ", " + message, packageName)); break; case PackageInstaller.STATUS_FAILURE_ABORTED: packageInstallerResultCallback.onInstallationResult( new InstallStatus(InstallStatus.Status.CANCELED, "Install failed " + status + ", " + message, packageName)); default: packageInstallerResultCallback.onInstallationResult( new InstallStatus(InstallStatus.Status.UNKNOWN_ERROR, "Unrecognized status received from installer", packageName)); } } }
Example 4
Source File: InstallActivity.java From XAPKInstaller with Apache License 2.0 | 4 votes |
@TargetApi(21) @Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); Bundle extras = intent.getExtras(); if (PACKAGE_INSTALLED_ACTION.equals(intent.getAction())) { int status = -100; String message = ""; if (extras != null) { status = extras.getInt(PackageInstaller.EXTRA_STATUS); message = extras.getString(PackageInstaller.EXTRA_STATUS_MESSAGE); } switch (status) { case PackageInstaller.STATUS_PENDING_USER_ACTION: // This test app isn't privileged, so the user has to confirm the install. Intent confirmIntent = (Intent) extras.get(Intent.EXTRA_INTENT); startActivity(confirmIntent); break; case PackageInstaller.STATUS_SUCCESS: Toast.makeText(this, "安装成功!", Toast.LENGTH_SHORT).show(); finish(); break; case PackageInstaller.STATUS_FAILURE: case PackageInstaller.STATUS_FAILURE_ABORTED: case PackageInstaller.STATUS_FAILURE_BLOCKED: case PackageInstaller.STATUS_FAILURE_CONFLICT: case PackageInstaller.STATUS_FAILURE_INCOMPATIBLE: case PackageInstaller.STATUS_FAILURE_INVALID: case PackageInstaller.STATUS_FAILURE_STORAGE: Toast.makeText(this, "安装失败,请重试", Toast.LENGTH_SHORT).show(); finish(); Log.d(TAG, "Install failed! " + status + ", " + message); break; default: Toast.makeText(this, "安装失败,解压文件可能已丢失或损坏,请重试", Toast.LENGTH_SHORT).show(); finish(); Log.d(TAG, "Unrecognized status received from installer: " + status); } } }
Example 5
Source File: PackageHelper.java From container with GNU General Public License v3.0 | 4 votes |
/** {@hide} */ public static int installStatusToPublicStatus(int status) { switch (status) { case INSTALL_SUCCEEDED: return PackageInstaller.STATUS_SUCCESS; case INSTALL_FAILED_ALREADY_EXISTS: return PackageInstaller.STATUS_FAILURE_CONFLICT; case INSTALL_FAILED_INVALID_APK: return PackageInstaller.STATUS_FAILURE_INVALID; case INSTALL_FAILED_INVALID_URI: return PackageInstaller.STATUS_FAILURE_INVALID; case INSTALL_FAILED_INSUFFICIENT_STORAGE: return PackageInstaller.STATUS_FAILURE_STORAGE; case INSTALL_FAILED_DUPLICATE_PACKAGE: return PackageInstaller.STATUS_FAILURE_CONFLICT; case INSTALL_FAILED_NO_SHARED_USER: return PackageInstaller.STATUS_FAILURE_CONFLICT; case INSTALL_FAILED_UPDATE_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_CONFLICT; case INSTALL_FAILED_SHARED_USER_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_CONFLICT; case INSTALL_FAILED_MISSING_SHARED_LIBRARY: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; case INSTALL_FAILED_REPLACE_COULDNT_DELETE: return PackageInstaller.STATUS_FAILURE_CONFLICT; case INSTALL_FAILED_DEXOPT: return PackageInstaller.STATUS_FAILURE_INVALID; case INSTALL_FAILED_OLDER_SDK: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; case INSTALL_FAILED_CONFLICTING_PROVIDER: return PackageInstaller.STATUS_FAILURE_CONFLICT; case INSTALL_FAILED_NEWER_SDK: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; case INSTALL_FAILED_TEST_ONLY: return PackageInstaller.STATUS_FAILURE_INVALID; case INSTALL_FAILED_CPU_ABI_INCOMPATIBLE: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; case INSTALL_FAILED_MISSING_FEATURE: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; case INSTALL_FAILED_CONTAINER_ERROR: return PackageInstaller.STATUS_FAILURE_STORAGE; case INSTALL_FAILED_INVALID_INSTALL_LOCATION: return PackageInstaller.STATUS_FAILURE_STORAGE; case INSTALL_FAILED_MEDIA_UNAVAILABLE: return PackageInstaller.STATUS_FAILURE_STORAGE; case INSTALL_FAILED_VERIFICATION_TIMEOUT: return PackageInstaller.STATUS_FAILURE_ABORTED; case INSTALL_FAILED_VERIFICATION_FAILURE: return PackageInstaller.STATUS_FAILURE_ABORTED; case INSTALL_FAILED_PACKAGE_CHANGED: return PackageInstaller.STATUS_FAILURE_INVALID; case INSTALL_FAILED_UID_CHANGED: return PackageInstaller.STATUS_FAILURE_INVALID; case INSTALL_FAILED_VERSION_DOWNGRADE: return PackageInstaller.STATUS_FAILURE_INVALID; case INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE: return PackageInstaller.STATUS_FAILURE_INVALID; case INSTALL_PARSE_FAILED_NOT_APK: return PackageInstaller.STATUS_FAILURE_INVALID; case INSTALL_PARSE_FAILED_BAD_MANIFEST: return PackageInstaller.STATUS_FAILURE_INVALID; case INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: return PackageInstaller.STATUS_FAILURE_INVALID; case INSTALL_PARSE_FAILED_NO_CERTIFICATES: return PackageInstaller.STATUS_FAILURE_INVALID; case INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES: return PackageInstaller.STATUS_FAILURE_INVALID; case INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING: return PackageInstaller.STATUS_FAILURE_INVALID; case INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME: return PackageInstaller.STATUS_FAILURE_INVALID; case INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID: return PackageInstaller.STATUS_FAILURE_INVALID; case INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: return PackageInstaller.STATUS_FAILURE_INVALID; case INSTALL_PARSE_FAILED_MANIFEST_EMPTY: return PackageInstaller.STATUS_FAILURE_INVALID; case INSTALL_FAILED_INTERNAL_ERROR: return PackageInstaller.STATUS_FAILURE; case INSTALL_FAILED_USER_RESTRICTED: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; case INSTALL_FAILED_DUPLICATE_PERMISSION: return PackageInstaller.STATUS_FAILURE_CONFLICT; case INSTALL_FAILED_NO_MATCHING_ABIS: return PackageInstaller.STATUS_FAILURE_INCOMPATIBLE; case INSTALL_FAILED_ABORTED: return PackageInstaller.STATUS_FAILURE_ABORTED; default: return PackageInstaller.STATUS_FAILURE; } }