STATUS_SUCCESS源码实例Demo

android.content.pm.PackageInstaller#STATUS_SUCCESS源码实例Demo

下面列出了android.content.pm.PackageInstaller#STATUS_SUCCESS 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: splitapkinstall   文件: APKInstallService.java
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    int status = intent.getIntExtra(PackageInstaller.EXTRA_STATUS, -999);
    switch (status) {
        case PackageInstaller.STATUS_PENDING_USER_ACTION:
            Log.d(TAG, "Requesting user confirmation for installation");
            Intent confirmationIntent = intent.getParcelableExtra(Intent.EXTRA_INTENT);
            confirmationIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            try {
                startActivity(confirmationIntent);
            } catch (Exception e) {
            }
            break;
        case PackageInstaller.STATUS_SUCCESS:
            Log.d(TAG, "Installation succeed");
            break;
        default:
            Log.d(TAG, "Installation failed");
            break;
    }
    stopSelf();
    return START_NOT_STICKY;
}
 
源代码2 项目: SAI   文件: RootlessSaiPiBroadcastReceiver.java
@Override
public void onReceive(Context context, Intent intent) {
    int status = intent.getIntExtra(PackageInstaller.EXTRA_STATUS, -999);
    switch (status) {
        case PackageInstaller.STATUS_PENDING_USER_ACTION:
            Log.d(TAG, "Requesting user confirmation for installation");
            dispatchOnConfirmationPending(intent.getIntExtra(PackageInstaller.EXTRA_SESSION_ID, -1), intent.getStringExtra(PackageInstaller.EXTRA_PACKAGE_NAME));
            Intent confirmationIntent = intent.getParcelableExtra(Intent.EXTRA_INTENT);

            ConfirmationIntentWrapperActivity2.start(context, intent.getIntExtra(PackageInstaller.EXTRA_SESSION_ID, -1), confirmationIntent);
            break;
        case PackageInstaller.STATUS_SUCCESS:
            Log.d(TAG, "Installation succeed");
            dispatchOnInstallationSucceeded(intent.getIntExtra(PackageInstaller.EXTRA_SESSION_ID, -1), intent.getStringExtra(PackageInstaller.EXTRA_PACKAGE_NAME));
            break;
        default:
            Log.d(TAG, "Installation failed");
            dispatchOnInstallationFailed(intent.getIntExtra(PackageInstaller.EXTRA_SESSION_ID, -1), parseError(intent), getRawError(intent), null);
            break;
    }
}
 
源代码3 项目: SAI   文件: RootlessSAIPIService.java
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    int status = intent.getIntExtra(PackageInstaller.EXTRA_STATUS, -999);
    switch (status) {
        case PackageInstaller.STATUS_PENDING_USER_ACTION:
            Log.d(TAG, "Requesting user confirmation for installation");
            sendStatusChangeBroadcast(intent.getIntExtra(PackageInstaller.EXTRA_SESSION_ID, -1), STATUS_CONFIRMATION_PENDING, intent.getStringExtra(PackageInstaller.EXTRA_PACKAGE_NAME));
            Intent confirmationIntent = intent.getParcelableExtra(Intent.EXTRA_INTENT);

            ConfirmationIntentWrapperActivity.start(this, intent.getIntExtra(PackageInstaller.EXTRA_SESSION_ID, -1), confirmationIntent);
            break;
        case PackageInstaller.STATUS_SUCCESS:
            Log.d(TAG, "Installation succeed");
            sendStatusChangeBroadcast(intent.getIntExtra(PackageInstaller.EXTRA_SESSION_ID, -1), STATUS_SUCCESS, intent.getStringExtra(PackageInstaller.EXTRA_PACKAGE_NAME));
            break;
        default:
            Log.d(TAG, "Installation failed");
            sendErrorBroadcast(intent.getIntExtra(PackageInstaller.EXTRA_SESSION_ID, -1), getErrorString(status, intent.getStringExtra(PackageInstaller.EXTRA_OTHER_PACKAGE_NAME)));
            break;
    }
    stopSelf();
    return START_NOT_STICKY;
}
 
源代码4 项目: Shelter   文件: DummyActivity.java
@Override
protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);

    if (intent.getAction().equals(PACKAGEINSTALLER_CALLBACK)) {
        int status = intent.getExtras().getInt(PackageInstaller.EXTRA_STATUS);

        switch (status) {
            case PackageInstaller.STATUS_PENDING_USER_ACTION:
                startActivity((Intent) intent.getExtras().get(Intent.EXTRA_INTENT));
                break;
            case PackageInstaller.STATUS_SUCCESS:
                appInstallFinished(Activity.RESULT_OK);
                break;
            default:
                appInstallFinished(Activity.RESULT_CANCELED);
                break;
        }
    }
}
 
private int uninstallSystemUpdates() {
    final PrintWriter pw = getOutPrintWriter();
    List<String> failedUninstalls = new LinkedList<>();
    try {
        final ParceledListSlice<ApplicationInfo> packages =
                mInterface.getInstalledApplications(
                        PackageManager.MATCH_SYSTEM_ONLY, UserHandle.USER_SYSTEM);
        final IPackageInstaller installer = mInterface.getPackageInstaller();
        List<ApplicationInfo> list = packages.getList();
        for (ApplicationInfo info : list) {
            if (info.isUpdatedSystemApp()) {
                pw.println("Uninstalling updates to " + info.packageName + "...");
                final LocalIntentReceiver receiver = new LocalIntentReceiver();
                installer.uninstall(new VersionedPackage(info.packageName,
                                info.versionCode), null /*callerPackageName*/, 0 /* flags */,
                        receiver.getIntentSender(), 0);

                final Intent result = receiver.getResult();
                final int status = result.getIntExtra(PackageInstaller.EXTRA_STATUS,
                        PackageInstaller.STATUS_FAILURE);
                if (status != PackageInstaller.STATUS_SUCCESS) {
                    failedUninstalls.add(info.packageName);
                }
            }
        }
    } catch (RemoteException e) {
        pw.println("Failure ["
                + e.getClass().getName() + " - "
                + e.getMessage() + "]");
        return 0;
    }
    if (!failedUninstalls.isEmpty()) {
        pw.println("Failure [Couldn't uninstall packages: "
                + TextUtils.join(", ", failedUninstalls)
                + "]");
        return 0;
    }
    pw.println("Success");
    return 1;
}
 
private int runInstall() throws RemoteException {
    final PrintWriter pw = getOutPrintWriter();
    final InstallParams params = makeInstallParams();
    final String inPath = getNextArg();

    setParamsSize(params, inPath);
    final int sessionId = doCreateSession(params.sessionParams,
            params.installerPackageName, params.userId);
    boolean abandonSession = true;
    try {
        if (inPath == null && params.sessionParams.sizeBytes == -1) {
            pw.println("Error: must either specify a package size or an APK file");
            return 1;
        }
        if (doWriteSplit(sessionId, inPath, params.sessionParams.sizeBytes, "base.apk",
                false /*logSuccess*/) != PackageInstaller.STATUS_SUCCESS) {
            return 1;
        }
        if (doCommitSession(sessionId, false /*logSuccess*/)
                != PackageInstaller.STATUS_SUCCESS) {
            return 1;
        }
        abandonSession = false;
        pw.println("Success");
        return 0;
    } finally {
        if (abandonSession) {
            try {
                doAbandonSession(sessionId, false /*logSuccess*/);
            } catch (Exception ignore) {
            }
        }
    }
}
 
private int runRemoveSplit(String packageName, String splitName) throws RemoteException {
    final PrintWriter pw = getOutPrintWriter();
    final SessionParams sessionParams = new SessionParams(SessionParams.MODE_INHERIT_EXISTING);
    sessionParams.installFlags |= PackageManager.INSTALL_REPLACE_EXISTING;
    sessionParams.appPackageName = packageName;
    final int sessionId =
            doCreateSession(sessionParams, null /*installerPackageName*/, UserHandle.USER_ALL);
    boolean abandonSession = true;
    try {
        if (doRemoveSplit(sessionId, splitName, false /*logSuccess*/)
                != PackageInstaller.STATUS_SUCCESS) {
            return 1;
        }
        if (doCommitSession(sessionId, false /*logSuccess*/)
                != PackageInstaller.STATUS_SUCCESS) {
            return 1;
        }
        abandonSession = false;
        pw.println("Success");
        return 0;
    } finally {
        if (abandonSession) {
            try {
                doAbandonSession(sessionId, false /*logSuccess*/);
            } catch (Exception ignore) {
            }
        }
    }
}
 
private int doCommitSession(int sessionId, boolean logSuccess) throws RemoteException {
    final PrintWriter pw = getOutPrintWriter();
    PackageInstaller.Session session = null;
    try {
        session = new PackageInstaller.Session(
                mInterface.getPackageInstaller().openSession(sessionId));

        // Sanity check that all .dm files match an apk.
        // (The installer does not support standalone .dm files and will not process them.)
        try {
            DexMetadataHelper.validateDexPaths(session.getNames());
        } catch (IllegalStateException | IOException e) {
            pw.println("Warning [Could not validate the dex paths: " + e.getMessage() + "]");
        }

        final LocalIntentReceiver receiver = new LocalIntentReceiver();
        session.commit(receiver.getIntentSender());

        final Intent result = receiver.getResult();
        final int status = result.getIntExtra(PackageInstaller.EXTRA_STATUS,
                PackageInstaller.STATUS_FAILURE);
        if (status == PackageInstaller.STATUS_SUCCESS) {
            if (logSuccess) {
                pw.println("Success");
            }
        } else {
            pw.println("Failure ["
                    + result.getStringExtra(PackageInstaller.EXTRA_STATUS_MESSAGE) + "]");
        }
        return status;
    } finally {
        IoUtils.closeQuietly(session);
    }
}
 
源代码9 项目: aptoide-client-v8   文件: InstallResultReceiver.java
@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));
    }
  }
}
 
源代码10 项目: android-testdpc   文件: EnableCosuActivity.java
@Override
public void onReceive(Context context, Intent intent) {
    if (!PackageInstallationUtils.ACTION_INSTALL_COMPLETE.equals(intent.getAction())) {
        return;
    }

    int result = intent.getIntExtra(PackageInstaller.EXTRA_STATUS,
            PackageInstaller.STATUS_FAILURE);
    String packageName = intent.getStringExtra(PackageInstaller.EXTRA_PACKAGE_NAME);
    if (CosuUtils.DEBUG) Log.d(CosuUtils.TAG, "PackageInstallerCallback: result=" + result
            + " packageName=" + packageName);
    switch (result) {
        case PackageInstaller.STATUS_PENDING_USER_ACTION: {
            // this should not happen in M, but will happen in L and L-MR1
            startActivity((Intent) intent.getParcelableExtra(Intent.EXTRA_INTENT));
        } break;
        case PackageInstaller.STATUS_SUCCESS: {
            mHandler.sendMessage(mHandler.obtainMessage(CosuUtils.MSG_INSTALL_COMPLETE,
                    packageName));
        } break;
        default: {
            Log.e(CosuUtils.TAG, "Install failed.");
            finishWithFailure();
            return;
        }
    }
}
 
private int runUninstall() throws RemoteException {
    final PrintWriter pw = getOutPrintWriter();
    int flags = 0;
    int userId = UserHandle.USER_ALL;
    long versionCode = PackageManager.VERSION_CODE_HIGHEST;

    String opt;
    while ((opt = getNextOption()) != null) {
        switch (opt) {
            case "-k":
                flags |= PackageManager.DELETE_KEEP_DATA;
                break;
            case "--user":
                userId = UserHandle.parseUserArg(getNextArgRequired());
                break;
            case "--versionCode":
                versionCode = Long.parseLong(getNextArgRequired());
                break;
            default:
                pw.println("Error: Unknown option: " + opt);
                return 1;
        }
    }

    final String packageName = getNextArg();
    if (packageName == null) {
        pw.println("Error: package name not specified");
        return 1;
    }

    // if a split is specified, just remove it and not the whole package
    final String splitName = getNextArg();
    if (splitName != null) {
        return runRemoveSplit(packageName, splitName);
    }

    userId = translateUserId(userId, true /*allowAll*/, "runUninstall");
    if (userId == UserHandle.USER_ALL) {
        userId = UserHandle.USER_SYSTEM;
        flags |= PackageManager.DELETE_ALL_USERS;
    } else {
        final PackageInfo info = mInterface.getPackageInfo(packageName,
                PackageManager.MATCH_STATIC_SHARED_LIBRARIES, userId);
        if (info == null) {
            pw.println("Failure [not installed for " + userId + "]");
            return 1;
        }
        final boolean isSystem =
                (info.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0;
        // If we are being asked to delete a system app for just one
        // user set flag so it disables rather than reverting to system
        // version of the app.
        if (isSystem) {
            flags |= PackageManager.DELETE_SYSTEM_APP;
        }
    }

    final LocalIntentReceiver receiver = new LocalIntentReceiver();
    mInterface.getPackageInstaller().uninstall(new VersionedPackage(packageName,
            versionCode), null /*callerPackageName*/, flags,
            receiver.getIntentSender(), userId);

    final Intent result = receiver.getResult();
    final int status = result.getIntExtra(PackageInstaller.EXTRA_STATUS,
            PackageInstaller.STATUS_FAILURE);
    if (status == PackageInstaller.STATUS_SUCCESS) {
        pw.println("Success");
        return 0;
    } else {
        pw.println("Failure ["
                + result.getStringExtra(PackageInstaller.EXTRA_STATUS_MESSAGE) + "]");
        return 1;
    }
}
 
源代码12 项目: XAPKInstaller   文件: InstallActivity.java
@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);
        }
    }
}
 
@Override
public void onReceive(Context context, Intent intent) {

    if (intent == null)
        return;

    int installStatus = intent.getIntExtra(PackageInstaller.EXTRA_STATUS, -1);
    String pkgName = intent.getStringExtra("pkgName");
    String name = intent.getStringExtra("name");

    Notification.Builder builder = Build.VERSION.SDK_INT >= 26 ?
            new Notification.Builder(context, "InstallPackages") :
            new Notification.Builder(context);

    NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);

    String message = null;
    if (installStatus != PackageInstaller.STATUS_SUCCESS) {
        message = intent.getStringExtra(PackageInstaller.EXTRA_STATUS_MESSAGE);
        if (message == null || "".equals(message)) {
            message = context.getString(R.string.unknown);
        }
        message = String.format(context.getString(R.string.reason_colon), message);
    }

    if (intent.getBooleanExtra("install", true)) {
        String apkFilePath = intent.getStringExtra("apkFilePath");

        // Delete Temp File
        InstallPackagesUtils.deleteTempFile(context, apkFilePath, false);

        if (installStatus == PackageInstaller.STATUS_SUCCESS) {
            InstallPackagesUtils
                    .notifyFinishNotification(
                            context, notificationManager, builder,
                            true,
                            pkgName,
                            String.format(context.getString(R.string.app_installFinished), name),
                            null,
                            true);

            if (PreferenceManager.getDefaultSharedPreferences(context)
                    .getBoolean("tryDelApkAfterInstalled", false))
                InstallPackagesUtils.deleteTempFile(context, apkFilePath, true);

        } else {
            InstallPackagesUtils
                    .notifyFinishNotification(
                            context, notificationManager, builder,
                            true,
                            pkgName,
                            String.format(context.getString(R.string.app_installFailed), name),
                            message,
                            false);
        }
    } else {
        if (installStatus == PackageInstaller.STATUS_SUCCESS) {
            InstallPackagesUtils
                    .notifyFinishNotification(
                            context, notificationManager, builder,
                            true,
                            pkgName,
                            String.format(context.getString(R.string.app_uninstallFinished), name),
                            null,
                            true);
        } else {
            InstallPackagesUtils
                    .notifyFinishNotification(
                            context, notificationManager, builder,
                            true,
                            pkgName,
                            String.format(context.getString(R.string.app_uninstallFailed), name),
                            message,
                            false);
        }
    }

}
 
源代码14 项目: container   文件: PackageHelper.java
/** {@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;
    }
}