Clean up IPackageManager install surface area.

Also more removal of encryption support.

Change-Id: If525dc5a8422134515f225a8ac4731e968069468
diff --git a/cmds/pm/src/com/android/commands/pm/Pm.java b/cmds/pm/src/com/android/commands/pm/Pm.java
index f85a7dc..a435fba 100644
--- a/cmds/pm/src/com/android/commands/pm/Pm.java
+++ b/cmds/pm/src/com/android/commands/pm/Pm.java
@@ -21,7 +21,6 @@
 import android.app.IActivityManager;
 import android.content.ComponentName;
 import android.content.pm.ApplicationInfo;
-import android.content.pm.ContainerEncryptionParams;
 import android.content.pm.FeatureInfo;
 import android.content.pm.IPackageDataObserver;
 import android.content.pm.IPackageDeleteObserver;
@@ -48,24 +47,19 @@
 import android.os.UserHandle;
 import android.os.UserManager;
 
+import com.android.internal.content.PackageHelper;
+import com.android.internal.util.ArrayUtils;
+
 import java.io.File;
 import java.io.FileDescriptor;
 import java.lang.reflect.Field;
 import java.lang.reflect.Modifier;
-import java.security.InvalidAlgorithmParameterException;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
 import java.util.WeakHashMap;
 
-import javax.crypto.SecretKey;
-import javax.crypto.spec.IvParameterSpec;
-import javax.crypto.spec.SecretKeySpec;
-
-import com.android.internal.content.PackageHelper;
-import com.android.internal.util.ArrayUtils;
-
 public final class Pm {
     IPackageManager mPm;
     IUserManager mUm;
@@ -816,13 +810,6 @@
 
         String opt;
 
-        String algo = null;
-        byte[] iv = null;
-        byte[] key = null;
-
-        String macAlgo = null;
-        byte[] macKey = null;
-        byte[] tag = null;
         String originatingUriString = null;
         String referrer = null;
         String abi = null;
@@ -848,42 +835,6 @@
                 installFlags |= PackageManager.INSTALL_INTERNAL;
             } else if (opt.equals("-d")) {
                 installFlags |= PackageManager.INSTALL_ALLOW_DOWNGRADE;
-            } else if (opt.equals("--algo")) {
-                algo = nextOptionData();
-                if (algo == null) {
-                    System.err.println("Error: must supply argument for --algo");
-                    return;
-                }
-            } else if (opt.equals("--iv")) {
-                iv = hexToBytes(nextOptionData());
-                if (iv == null) {
-                    System.err.println("Error: must supply argument for --iv");
-                    return;
-                }
-            } else if (opt.equals("--key")) {
-                key = hexToBytes(nextOptionData());
-                if (key == null) {
-                    System.err.println("Error: must supply argument for --key");
-                    return;
-                }
-            } else if (opt.equals("--macalgo")) {
-                macAlgo = nextOptionData();
-                if (macAlgo == null) {
-                    System.err.println("Error: must supply argument for --macalgo");
-                    return;
-                }
-            } else if (opt.equals("--mackey")) {
-                macKey = hexToBytes(nextOptionData());
-                if (macKey == null) {
-                    System.err.println("Error: must supply argument for --mackey");
-                    return;
-                }
-            } else if (opt.equals("--tag")) {
-                tag = hexToBytes(nextOptionData());
-                if (tag == null) {
-                    System.err.println("Error: must supply argument for --tag");
-                    return;
-                }
             } else if (opt.equals("--originating-uri")) {
                 originatingUriString = nextOptionData();
                 if (originatingUriString == null) {
@@ -924,43 +875,6 @@
             }
         }
 
-        final ContainerEncryptionParams encryptionParams;
-        if (algo != null || iv != null || key != null || macAlgo != null || macKey != null
-                || tag != null) {
-            if (algo == null || iv == null || key == null) {
-                System.err.println("Error: all of --algo, --iv, and --key must be specified");
-                return;
-            }
-
-            if (macAlgo != null || macKey != null || tag != null) {
-                if (macAlgo == null || macKey == null || tag == null) {
-                    System.err.println("Error: all of --macalgo, --mackey, and --tag must "
-                            + "be specified");
-                    return;
-                }
-            }
-
-            try {
-                final SecretKey encKey = new SecretKeySpec(key, "RAW");
-
-                final SecretKey macSecretKey;
-                if (macKey == null || macKey.length == 0) {
-                    macSecretKey = null;
-                } else {
-                    macSecretKey = new SecretKeySpec(macKey, "RAW");
-                }
-
-                encryptionParams = new ContainerEncryptionParams(algo, new IvParameterSpec(iv),
-                        encKey, macAlgo, null, macSecretKey, tag, -1, -1, -1);
-            } catch (InvalidAlgorithmParameterException e) {
-                e.printStackTrace();
-                return;
-            }
-        } else {
-            encryptionParams = null;
-        }
-
-        final Uri apkURI;
         final Uri verificationURI;
         final Uri originatingURI;
         final Uri referrerURI;
@@ -980,9 +894,7 @@
         // Populate apkURI, must be present
         final String apkFilePath = nextArg();
         System.err.println("\tpkg: " + apkFilePath);
-        if (apkFilePath != null) {
-            apkURI = Uri.fromFile(new File(apkFilePath));
-        } else {
+        if (apkFilePath == null) {
             System.err.println("Error: no package specified");
             return;
         }
@@ -1001,9 +913,8 @@
             VerificationParams verificationParams = new VerificationParams(verificationURI,
                     originatingURI, referrerURI, VerificationParams.NO_UID, null);
 
-            mPm.installPackageWithVerificationEncryptionAndAbiOverrideEtc(apkURI, null,
-                    obs, installFlags, installerPackageName, verificationParams,
-                    encryptionParams, abi);
+            mPm.installPackage(apkFilePath, obs, installFlags, installerPackageName,
+                    verificationParams, abi);
 
             synchronized (obs) {
                 while (!obs.finished) {
diff --git a/core/java/android/app/ApplicationPackageManager.java b/core/java/android/app/ApplicationPackageManager.java
index e2f3c60..97f1e50 100644
--- a/core/java/android/app/ApplicationPackageManager.java
+++ b/core/java/android/app/ApplicationPackageManager.java
@@ -29,11 +29,11 @@
 import android.content.pm.IPackageDataObserver;
 import android.content.pm.IPackageDeleteObserver;
 import android.content.pm.IPackageInstallObserver;
-import android.content.pm.IPackageInstallObserver2;
 import android.content.pm.IPackageManager;
 import android.content.pm.IPackageMoveObserver;
 import android.content.pm.IPackageStatsObserver;
 import android.content.pm.InstrumentationInfo;
+import android.content.pm.ManifestDigest;
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageInstaller;
 import android.content.pm.PackageItemInfo;
@@ -44,15 +44,14 @@
 import android.content.pm.ProviderInfo;
 import android.content.pm.ResolveInfo;
 import android.content.pm.ServiceInfo;
-import android.content.pm.ManifestDigest;
 import android.content.pm.VerificationParams;
 import android.content.pm.VerifierDeviceIdentity;
 import android.content.res.Resources;
 import android.content.res.XmlResourceParser;
-import android.graphics.Bitmap;
 import android.graphics.drawable.BitmapDrawable;
 import android.graphics.drawable.Drawable;
 import android.net.Uri;
+import android.os.Bundle;
 import android.os.Process;
 import android.os.RemoteException;
 import android.os.UserHandle;
@@ -1112,47 +1111,36 @@
     @Override
     public void installPackage(Uri packageURI, IPackageInstallObserver observer, int flags,
                                String installerPackageName) {
-        try {
-            mPM.installPackageEtc(packageURI, observer, null, flags, installerPackageName);
-        } catch (RemoteException e) {
-            // Should never happen!
-        }
+        final VerificationParams verificationParams = new VerificationParams(null, null,
+                null, VerificationParams.NO_UID, null);
+        installCommon(packageURI, new LegacyPackageInstallObserver(observer), flags,
+                installerPackageName, verificationParams, null);
     }
 
     @Override
     public void installPackageWithVerification(Uri packageURI, IPackageInstallObserver observer,
             int flags, String installerPackageName, Uri verificationURI,
             ManifestDigest manifestDigest, ContainerEncryptionParams encryptionParams) {
-        try {
-            mPM.installPackageWithVerificationEtc(packageURI, observer, null, flags,
-                    installerPackageName, verificationURI, manifestDigest, encryptionParams);
-        } catch (RemoteException e) {
-            // Should never happen!
-        }
+        final VerificationParams verificationParams = new VerificationParams(verificationURI, null,
+                null, VerificationParams.NO_UID, manifestDigest);
+        installCommon(packageURI, new LegacyPackageInstallObserver(observer), flags,
+                installerPackageName, verificationParams, encryptionParams);
     }
 
     @Override
     public void installPackageWithVerificationAndEncryption(Uri packageURI,
             IPackageInstallObserver observer, int flags, String installerPackageName,
             VerificationParams verificationParams, ContainerEncryptionParams encryptionParams) {
-        try {
-            mPM.installPackageWithVerificationAndEncryptionEtc(packageURI, observer, null,
-                    flags, installerPackageName, verificationParams, encryptionParams);
-        } catch (RemoteException e) {
-            // Should never happen!
-        }
+        installCommon(packageURI, new LegacyPackageInstallObserver(observer), flags,
+                installerPackageName, verificationParams, encryptionParams);
     }
 
-    // Expanded observer-API versions
     @Override
     public void installPackage(Uri packageURI, PackageInstallObserver observer,
             int flags, String installerPackageName) {
-        try {
-            mPM.installPackageEtc(packageURI, null, observer.getBinder(),
-                    flags, installerPackageName);
-        } catch (RemoteException e) {
-            // Should never happen!
-        }
+        final VerificationParams verificationParams = new VerificationParams(null, null,
+                null, VerificationParams.NO_UID, null);
+        installCommon(packageURI, observer, flags, installerPackageName, verificationParams, null);
     }
 
     @Override
@@ -1160,24 +1148,35 @@
             PackageInstallObserver observer, int flags, String installerPackageName,
             Uri verificationURI, ManifestDigest manifestDigest,
             ContainerEncryptionParams encryptionParams) {
-        try {
-            mPM.installPackageWithVerificationEtc(packageURI, null, observer.getBinder(), flags,
-                    installerPackageName, verificationURI, manifestDigest, encryptionParams);
-        } catch (RemoteException e) {
-            // Should never happen!
-        }
+        final VerificationParams verificationParams = new VerificationParams(verificationURI, null,
+                null, VerificationParams.NO_UID, manifestDigest);
+        installCommon(packageURI, observer, flags, installerPackageName, verificationParams,
+                encryptionParams);
     }
 
     @Override
     public void installPackageWithVerificationAndEncryption(Uri packageURI,
             PackageInstallObserver observer, int flags, String installerPackageName,
             VerificationParams verificationParams, ContainerEncryptionParams encryptionParams) {
+        installCommon(packageURI, observer, flags, installerPackageName, verificationParams,
+                encryptionParams);
+    }
+
+    private void installCommon(Uri packageURI,
+            PackageInstallObserver observer, int flags, String installerPackageName,
+            VerificationParams verificationParams, ContainerEncryptionParams encryptionParams) {
+        if (!"file".equals(packageURI.getScheme())) {
+            throw new UnsupportedOperationException("Only file:// URIs are supported");
+        }
+        if (encryptionParams != null) {
+            throw new UnsupportedOperationException("ContainerEncryptionParams not supported");
+        }
+
+        final String originPath = packageURI.getPath();
         try {
-            mPM.installPackageWithVerificationAndEncryptionEtc(packageURI, null,
-                    observer.getBinder(), flags, installerPackageName, verificationParams,
-                    encryptionParams);
-        } catch (RemoteException e) {
-            // Should never happen!
+            mPM.installPackage(originPath, observer.getBinder(), flags, installerPackageName,
+                    verificationParams, null);
+        } catch (RemoteException ignored) {
         }
     }
 
@@ -1523,6 +1522,22 @@
         return dr;
     }
 
+    private static class LegacyPackageInstallObserver extends PackageInstallObserver {
+        private final IPackageInstallObserver mLegacy;
+
+        public LegacyPackageInstallObserver(IPackageInstallObserver legacy) {
+            mLegacy = legacy;
+        }
+
+        @Override
+        public void packageInstalled(String basePackageName, Bundle extras, int returnCode) {
+            try {
+                mLegacy.packageInstalled(basePackageName, returnCode);
+            } catch (RemoteException ignored) {
+            }
+        }
+    }
+
     private final ContextImpl mContext;
     private final IPackageManager mPM;
 
diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl
index 40dec8f..58d3526 100644
--- a/core/java/android/content/pm/IPackageManager.aidl
+++ b/core/java/android/content/pm/IPackageManager.aidl
@@ -189,18 +189,12 @@
     List<InstrumentationInfo> queryInstrumentation(
             String targetPackage, int flags);
 
-    /**
-     * Install a package.
-     *
-     * @param packageURI The location of the package file to install.
-     * @param observer a callback to use to notify when the package installation in finished.
-     * @param flags - possible values: {@link #FORWARD_LOCK_PACKAGE},
-     * {@link #REPLACE_EXISITING_PACKAGE}
-     * @param installerPackageName Optional package name of the application that is performing the
-     * installation. This identifies which market the package came from.
-     */
-    void installPackage(in Uri packageURI, IPackageInstallObserver observer, int flags,
-            in String installerPackageName);
+    void installPackage(in String originPath,
+            in IPackageInstallObserver2 observer,
+            int flags,
+            in String installerPackageName,
+            in VerificationParams verificationParams,
+            in String packageAbiOverride);
 
     void finishPackageInstall(int token);
 
@@ -412,37 +406,6 @@
     boolean setInstallLocation(int loc);
     int getInstallLocation();
 
-    void installPackageWithVerification(in Uri packageURI, in IPackageInstallObserver observer,
-            int flags, in String installerPackageName, in Uri verificationURI,
-            in ManifestDigest manifestDigest, in ContainerEncryptionParams encryptionParams);
-
-    void installPackageWithVerificationAndEncryption(in Uri packageURI,
-            in IPackageInstallObserver observer, int flags, in String installerPackageName,
-            in VerificationParams verificationParams,
-            in ContainerEncryptionParams encryptionParams);
-
-    /** Expanded observer versions */
-    void installPackageEtc(in Uri packageURI, IPackageInstallObserver observer,
-            IPackageInstallObserver2 observer2, int flags, in String installerPackageName);
-
-    void installPackageWithVerificationEtc(in Uri packageURI,
-            in IPackageInstallObserver observer, IPackageInstallObserver2 observer2,
-            int flags, in String installerPackageName, in Uri verificationURI,
-            in ManifestDigest manifestDigest, in ContainerEncryptionParams encryptionParams);
-
-    void installPackageWithVerificationAndEncryptionEtc(in Uri packageURI,
-            in IPackageInstallObserver observer, in IPackageInstallObserver2 observer2,
-            int flags, in String installerPackageName,
-            in VerificationParams verificationParams,
-            in ContainerEncryptionParams encryptionParams);
-
-    void installPackageWithVerificationEncryptionAndAbiOverrideEtc(in Uri packageURI,
-            in IPackageInstallObserver observer, in IPackageInstallObserver2 observer2,
-            int flags, in String installerPackageName,
-            in VerificationParams verificationParams,
-            in ContainerEncryptionParams encryptionParams,
-        in String packageAbiOverride);
-
     int installExistingPackageAsUser(String packageName, int userId);
 
     void verifyPendingInstall(int id, int verificationCode);
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index b65cf72..c2fb773 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -25,6 +25,7 @@
 import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER;
 import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
 import static android.content.pm.PackageManager.INSTALL_EXTERNAL;
+import static android.content.pm.PackageManager.INSTALL_FAILED_USER_RESTRICTED;
 import static android.content.pm.PackageManager.INSTALL_FORWARD_LOCK;
 import static android.content.pm.PackageParser.isApkFile;
 import static android.os.Process.PACKAGE_INFO_GID;
@@ -87,7 +88,6 @@
 import android.content.ServiceConnection;
 import android.content.pm.ActivityInfo;
 import android.content.pm.ApplicationInfo;
-import android.content.pm.ContainerEncryptionParams;
 import android.content.pm.FeatureInfo;
 import android.content.pm.IPackageDataObserver;
 import android.content.pm.IPackageDeleteObserver;
@@ -1093,15 +1093,8 @@
                         }
                         if (args.observer != null) {
                             try {
-                                args.observer.packageInstalled(res.name, res.returnCode);
-                            } catch (RemoteException e) {
-                                Slog.i(TAG, "Observer no longer exists.");
-                            }
-                        }
-                        if (args.observer2 != null) {
-                            try {
                                 Bundle extras = extrasForInstallResult(res);
-                                args.observer2.packageInstalled(res.name, extras, res.returnCode);
+                                args.observer.packageInstalled(res.name, extras, res.returnCode);
                             } catch (RemoteException e) {
                                 Slog.i(TAG, "Observer no longer exists.");
                             }
@@ -7617,104 +7610,19 @@
         private final boolean mIsPrivileged;
     }
 
-    /*
-     * The old-style observer methods all just trampoline to the newer signature with
-     * expanded install observer API.  The older API continues to work but does not
-     * supply the additional details of the Observer2 API.
-     */
-
-    /* Called when a downloaded package installation has been confirmed by the user */
-    public void installPackage(
-            final Uri packageURI, final IPackageInstallObserver observer, final int flags) {
-        installPackageEtc(packageURI, observer, null, flags, null);
-    }
-
-    /* Called when a downloaded package installation has been confirmed by the user */
     @Override
-    public void installPackage(
-            final Uri packageURI, final IPackageInstallObserver observer, final int flags,
-            final String installerPackageName) {
-        installPackageWithVerificationEtc(packageURI, observer, null, flags,
-                installerPackageName, null, null, null);
-    }
-
-    @Override
-    public void installPackageWithVerification(Uri packageURI, IPackageInstallObserver observer,
-            int flags, String installerPackageName, Uri verificationURI,
-            ManifestDigest manifestDigest, ContainerEncryptionParams encryptionParams) {
-        VerificationParams verificationParams = new VerificationParams(verificationURI, null, null,
-                VerificationParams.NO_UID, manifestDigest);
-        installPackageWithVerificationAndEncryptionEtc(packageURI, observer, null, flags,
-                installerPackageName, verificationParams, encryptionParams);
-    }
-
-    @Override
-    public void installPackageWithVerificationAndEncryption(Uri packageURI,
-            IPackageInstallObserver observer, int flags, String installerPackageName,
-            VerificationParams verificationParams, ContainerEncryptionParams encryptionParams) {
-        installPackageWithVerificationAndEncryptionEtc(packageURI, observer, null, flags,
-                installerPackageName, verificationParams, encryptionParams);
-    }
-
-    /*
-     * And here are the "live" versions that take both observer arguments
-     */
-    public void installPackageEtc(
-            final Uri packageURI, final IPackageInstallObserver observer,
-            IPackageInstallObserver2 observer2, final int flags) {
-        installPackageEtc(packageURI, observer, observer2, flags, null);
-    }
-
-    public void installPackageEtc(
-            final Uri packageURI, final IPackageInstallObserver observer,
-            final IPackageInstallObserver2 observer2, final int flags,
-            final String installerPackageName) {
-        installPackageWithVerificationEtc(packageURI, observer, observer2, flags,
-                installerPackageName, null, null, null);
-    }
-
-    @Override
-    public void installPackageWithVerificationEtc(Uri packageURI, IPackageInstallObserver observer,
-            IPackageInstallObserver2 observer2,
-            int flags, String installerPackageName, Uri verificationURI,
-            ManifestDigest manifestDigest, ContainerEncryptionParams encryptionParams) {
-        VerificationParams verificationParams = new VerificationParams(verificationURI, null, null,
-                VerificationParams.NO_UID, manifestDigest);
-        installPackageWithVerificationAndEncryptionEtc(packageURI, observer, observer2, flags,
-                installerPackageName, verificationParams, encryptionParams);
-    }
-
-    /*
-     * All of the installPackage...*() methods redirect to this one for the master implementation
-     */
-    public void installPackageWithVerificationAndEncryptionEtc(Uri packageURI,
-            IPackageInstallObserver observer, IPackageInstallObserver2 observer2,
-            int flags, String installerPackageName,
-            VerificationParams verificationParams, ContainerEncryptionParams encryptionParams) {
-        if (observer == null && observer2 == null) {
-            throw new IllegalArgumentException("No install observer supplied");
-        }
-        installPackageWithVerificationEncryptionAndAbiOverrideEtc(packageURI, observer, observer2,
-                flags, installerPackageName, verificationParams, encryptionParams, null);
-    }
-
-    @Override
-    public void installPackageWithVerificationEncryptionAndAbiOverrideEtc(Uri packageURI,
-            IPackageInstallObserver observer, IPackageInstallObserver2 observer2,
-            int flags, String installerPackageName,
-            VerificationParams verificationParams, ContainerEncryptionParams encryptionParams,
+    public void installPackage(String originPath, IPackageInstallObserver2 observer, int flags,
+            String installerPackageName, VerificationParams verificationParams,
             String packageAbiOverride) {
         mContext.enforceCallingOrSelfPermission(android.Manifest.permission.INSTALL_PACKAGES,
                 null);
 
+        final File originFile = new File(originPath);
         final int uid = Binder.getCallingUid();
         if (isUserRestricted(UserHandle.getUserId(uid), UserManager.DISALLOW_INSTALL_APPS)) {
             try {
                 if (observer != null) {
-                    observer.packageInstalled("", PackageManager.INSTALL_FAILED_USER_RESTRICTED);
-                }
-                if (observer2 != null) {
-                    observer2.packageInstalled("", null, PackageManager.INSTALL_FAILED_USER_RESTRICTED);
+                    observer.packageInstalled("", null, INSTALL_FAILED_USER_RESTRICTED);
                 }
             } catch (RemoteException re) {
             }
@@ -7729,7 +7637,6 @@
         }
 
         final int filteredFlags;
-
         if (uid == Process.SHELL_UID || uid == 0) {
             if (DEBUG_INSTALL) {
                 Slog.v(TAG, "Install from ADB");
@@ -7741,18 +7648,9 @@
 
         verificationParams.setInstallerUid(uid);
 
-        if (!"file".equals(packageURI.getScheme())) {
-            throw new UnsupportedOperationException("Only file:// URIs are supported");
-        }
-        final File fromFile = new File(packageURI.getPath());
-
-        if (encryptionParams != null) {
-            throw new UnsupportedOperationException("ContainerEncryptionParams not supported");
-        }
-
         final Message msg = mHandler.obtainMessage(INIT_COPY);
-        msg.obj = new InstallParams(fromFile, observer, observer2, filteredFlags,
-                installerPackageName, verificationParams, user, packageAbiOverride);
+        msg.obj = new InstallParams(originFile, observer, filteredFlags, installerPackageName,
+                verificationParams, user, packageAbiOverride);
         mHandler.sendMessage(msg);
     }
 
@@ -8469,8 +8367,7 @@
          */
         boolean originTrusted;
 
-        final IPackageInstallObserver observer;
-        final IPackageInstallObserver2 observer2;
+        final IPackageInstallObserver2 observer;
         int flags;
         final String installerPackageName;
         final VerificationParams verificationParams;
@@ -8479,14 +8376,13 @@
         final String packageAbiOverride;
         final String packageInstructionSetOverride;
 
-        InstallParams(File originFile, IPackageInstallObserver observer,
-                IPackageInstallObserver2 observer2, int flags, String installerPackageName,
-                VerificationParams verificationParams, UserHandle user, String packageAbiOverride) {
+        InstallParams(File originFile, IPackageInstallObserver2 observer, int flags,
+                String installerPackageName, VerificationParams verificationParams, UserHandle user,
+                String packageAbiOverride) {
             super(user);
             this.originFile = Preconditions.checkNotNull(originFile);
             this.originTrusted = false;
             this.observer = observer;
-            this.observer2 = observer2;
             this.flags = flags;
             this.installerPackageName = installerPackageName;
             this.verificationParams = verificationParams;
@@ -9018,8 +8914,7 @@
 
         // TODO: define inherit location
 
-        final IPackageInstallObserver observer;
-        final IPackageInstallObserver2 observer2;
+        final IPackageInstallObserver2 observer;
         // Always refers to PackageManager flags only
         final int flags;
         final String installerPackageName;
@@ -9028,15 +8923,13 @@
         final String instructionSet;
         final String abiOverride;
 
-        InstallArgs(File originFile, boolean originTrusted, IPackageInstallObserver observer,
-                IPackageInstallObserver2 observer2, int flags, String installerPackageName,
-                ManifestDigest manifestDigest, UserHandle user, String instructionSet,
-                String abiOverride) {
+        InstallArgs(File originFile, boolean originTrusted, IPackageInstallObserver2 observer,
+                int flags, String installerPackageName, ManifestDigest manifestDigest,
+                UserHandle user, String instructionSet, String abiOverride) {
             this.originFile = originFile;
             this.originTrusted = originTrusted;
             this.flags = flags;
             this.observer = observer;
-            this.observer2 = observer2;
             this.installerPackageName = installerPackageName;
             this.manifestDigest = manifestDigest;
             this.user = user;
@@ -9113,10 +9006,9 @@
 
         /** New install */
         FileInstallArgs(InstallParams params) {
-            super(params.originFile, params.originTrusted, params.observer, params.observer2,
-                    params.flags, params.installerPackageName, params.getManifestDigest(),
-                    params.getUser(), params.packageInstructionSetOverride,
-                    params.packageAbiOverride);
+            super(params.originFile, params.originTrusted, params.observer, params.flags,
+                    params.installerPackageName, params.getManifestDigest(), params.getUser(),
+                    params.packageInstructionSetOverride, params.packageAbiOverride);
             if (isFwdLocked()) {
                 throw new IllegalArgumentException("Forward locking only supported in ASEC");
             }
@@ -9125,7 +9017,7 @@
         /** Existing install */
         FileInstallArgs(String codePath, String resourcePath, String nativeLibraryPath,
                 String instructionSet) {
-            super(null, false, null, null, 0, null, null, null, instructionSet, null);
+            super(null, false, null, 0, null, null, null, instructionSet, null);
             this.codeFile = (codePath != null) ? new File(codePath) : null;
             this.resourceFile = (resourcePath != null) ? new File(resourcePath) : null;
             this.nativeLibraryFile = (nativeLibraryPath != null) ? new File(nativeLibraryPath) : null;
@@ -9133,7 +9025,7 @@
 
         /** New install from existing */
         FileInstallArgs(File originFile, String instructionSet) {
-            super(originFile, true, null, null, 0, null, null, null, instructionSet, null);
+            super(originFile, true, null, 0, null, null, null, instructionSet, null);
         }
 
         boolean checkFreeStorage(IMediaContainerService imcs) throws RemoteException {
@@ -9393,16 +9285,15 @@
 
         /** New install */
         AsecInstallArgs(InstallParams params) {
-            super(params.originFile, params.originTrusted, params.observer, params.observer2,
-                    params.flags, params.installerPackageName, params.getManifestDigest(),
-                    params.getUser(), params.packageInstructionSetOverride,
-                    params.packageAbiOverride);
+            super(params.originFile, params.originTrusted, params.observer, params.flags,
+                    params.installerPackageName, params.getManifestDigest(), params.getUser(),
+                    params.packageInstructionSetOverride, params.packageAbiOverride);
         }
 
         /** Existing install */
         AsecInstallArgs(String fullCodePath, String fullResourcePath, String nativeLibraryPath,
                 String instructionSet, boolean isExternal, boolean isForwardLocked) {
-            super(null, false, null, null, (isExternal ? INSTALL_EXTERNAL : 0)
+            super(null, false, null, (isExternal ? INSTALL_EXTERNAL : 0)
                     | (isForwardLocked ? INSTALL_FORWARD_LOCK : 0), null, null, null,
                     instructionSet, null);
             // Extract cid from fullCodePath
@@ -9414,7 +9305,7 @@
         }
 
         AsecInstallArgs(String cid, String instructionSet, boolean isForwardLocked) {
-            super(null, false, null, null, (isAsecExternal(cid) ? INSTALL_EXTERNAL : 0)
+            super(null, false, null, (isAsecExternal(cid) ? INSTALL_EXTERNAL : 0)
                     | (isForwardLocked ? INSTALL_FORWARD_LOCK : 0), null, null, null,
                     instructionSet, null);
             this.cid = cid;
@@ -9424,7 +9315,7 @@
         /** New install from existing */
         AsecInstallArgs(File originPackageFile, String cid, String instructionSet,
                 boolean isExternal, boolean isForwardLocked) {
-            super(originPackageFile, true, null, null, (isExternal ? INSTALL_EXTERNAL : 0)
+            super(originPackageFile, true, null, (isExternal ? INSTALL_EXTERNAL : 0)
                     | (isForwardLocked ? INSTALL_FORWARD_LOCK : 0), null, null, null,
                     instructionSet, null);
             this.cid = cid;