Move ApplicationThread to aidl.

Bug: 30977067
Test: Existing tests are passing, dump commands still working.
Change-Id: Iecb382e8720dfb1b6b707272497e3793e6995edb
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java
index d91472b..112b614b 100644
--- a/core/java/android/app/ActivityManagerNative.java
+++ b/core/java/android/app/ActivityManagerNative.java
@@ -150,7 +150,7 @@
         {
             data.enforceInterface(IActivityManager.descriptor);
             IBinder b = data.readStrongBinder();
-            IApplicationThread app = ApplicationThreadNative.asInterface(b);
+            IApplicationThread app = IApplicationThread.Stub.asInterface(b);
             String callingPackage = data.readString();
             Intent intent = Intent.CREATOR.createFromParcel(data);
             String resolvedType = data.readString();
@@ -173,7 +173,7 @@
         {
             data.enforceInterface(IActivityManager.descriptor);
             IBinder b = data.readStrongBinder();
-            IApplicationThread app = ApplicationThreadNative.asInterface(b);
+            IApplicationThread app = IApplicationThread.Stub.asInterface(b);
             String callingPackage = data.readString();
             Intent intent = Intent.CREATOR.createFromParcel(data);
             String resolvedType = data.readString();
@@ -197,7 +197,7 @@
         {
             data.enforceInterface(IActivityManager.descriptor);
             IBinder b = data.readStrongBinder();
-            IApplicationThread app = ApplicationThreadNative.asInterface(b);
+            IApplicationThread app = IApplicationThread.Stub.asInterface(b);
             String callingPackage = data.readString();
             Intent intent = Intent.CREATOR.createFromParcel(data);
             String resolvedType = data.readString();
@@ -223,7 +223,7 @@
         {
             data.enforceInterface(IActivityManager.descriptor);
             IBinder b = data.readStrongBinder();
-            IApplicationThread app = ApplicationThreadNative.asInterface(b);
+            IApplicationThread app = IApplicationThread.Stub.asInterface(b);
             String callingPackage = data.readString();
             Intent intent = Intent.CREATOR.createFromParcel(data);
             String resolvedType = data.readString();
@@ -247,7 +247,7 @@
         {
             data.enforceInterface(IActivityManager.descriptor);
             IBinder b = data.readStrongBinder();
-            IApplicationThread app = ApplicationThreadNative.asInterface(b);
+            IApplicationThread app = IApplicationThread.Stub.asInterface(b);
             String callingPackage = data.readString();
             Intent intent = Intent.CREATOR.createFromParcel(data);
             String resolvedType = data.readString();
@@ -270,7 +270,7 @@
         {
             data.enforceInterface(IActivityManager.descriptor);
             IBinder b = data.readStrongBinder();
-            IApplicationThread app = ApplicationThreadNative.asInterface(b);
+            IApplicationThread app = IApplicationThread.Stub.asInterface(b);
             IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
             Intent fillInIntent = null;
             if (data.readInt() != 0) {
@@ -432,7 +432,7 @@
 
         case RELEASE_SOME_ACTIVITIES_TRANSACTION: {
             data.enforceInterface(IActivityManager.descriptor);
-            IApplicationThread app = ApplicationThreadNative.asInterface(data.readStrongBinder());
+            IApplicationThread app = IApplicationThread.Stub.asInterface(data.readStrongBinder());
             releaseSomeActivities(app);
             reply.writeNoException();
             return true;
@@ -452,7 +452,7 @@
             data.enforceInterface(IActivityManager.descriptor);
             IBinder b = data.readStrongBinder();
             IApplicationThread app =
-                b != null ? ApplicationThreadNative.asInterface(b) : null;
+                b != null ? IApplicationThread.Stub.asInterface(b) : null;
             String packageName = data.readString();
             b = data.readStrongBinder();
             IIntentReceiver rec
@@ -489,7 +489,7 @@
             data.enforceInterface(IActivityManager.descriptor);
             IBinder b = data.readStrongBinder();
             IApplicationThread app =
-                b != null ? ApplicationThreadNative.asInterface(b) : null;
+                b != null ? IApplicationThread.Stub.asInterface(b) : null;
             Intent intent = Intent.CREATOR.createFromParcel(data);
             String resolvedType = data.readString();
             b = data.readStrongBinder();
@@ -516,7 +516,7 @@
         {
             data.enforceInterface(IActivityManager.descriptor);
             IBinder b = data.readStrongBinder();
-            IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
+            IApplicationThread app = b != null ? IApplicationThread.Stub.asInterface(b) : null;
             Intent intent = Intent.CREATOR.createFromParcel(data);
             int userId = data.readInt();
             unbroadcastIntent(app, intent, userId);
@@ -541,7 +541,7 @@
 
         case ATTACH_APPLICATION_TRANSACTION: {
             data.enforceInterface(IActivityManager.descriptor);
-            IApplicationThread app = ApplicationThreadNative.asInterface(
+            IApplicationThread app = IApplicationThread.Stub.asInterface(
                     data.readStrongBinder());
             if (app != null) {
                 attachApplication(app);
@@ -978,7 +978,7 @@
         case GET_CONTENT_PROVIDER_TRANSACTION: {
             data.enforceInterface(IActivityManager.descriptor);
             IBinder b = data.readStrongBinder();
-            IApplicationThread app = ApplicationThreadNative.asInterface(b);
+            IApplicationThread app = IApplicationThread.Stub.asInterface(b);
             String name = data.readString();
             int userId = data.readInt();
             boolean stable = data.readInt() != 0;
@@ -1012,7 +1012,7 @@
         case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
             data.enforceInterface(IActivityManager.descriptor);
             IBinder b = data.readStrongBinder();
-            IApplicationThread app = ApplicationThreadNative.asInterface(b);
+            IApplicationThread app = IApplicationThread.Stub.asInterface(b);
             ArrayList<ContentProviderHolder> providers =
                 data.createTypedArrayList(ContentProviderHolder.CREATOR);
             publishContentProviders(app, providers);
@@ -1077,7 +1077,7 @@
         case START_SERVICE_TRANSACTION: {
             data.enforceInterface(IActivityManager.descriptor);
             IBinder b = data.readStrongBinder();
-            IApplicationThread app = ApplicationThreadNative.asInterface(b);
+            IApplicationThread app = IApplicationThread.Stub.asInterface(b);
             Intent service = Intent.CREATOR.createFromParcel(data);
             String resolvedType = data.readString();
             String callingPackage = data.readString();
@@ -1091,7 +1091,7 @@
         case STOP_SERVICE_TRANSACTION: {
             data.enforceInterface(IActivityManager.descriptor);
             IBinder b = data.readStrongBinder();
-            IApplicationThread app = ApplicationThreadNative.asInterface(b);
+            IApplicationThread app = IApplicationThread.Stub.asInterface(b);
             Intent service = Intent.CREATOR.createFromParcel(data);
             String resolvedType = data.readString();
             int userId = data.readInt();
@@ -1130,7 +1130,7 @@
         case BIND_SERVICE_TRANSACTION: {
             data.enforceInterface(IActivityManager.descriptor);
             IBinder b = data.readStrongBinder();
-            IApplicationThread app = ApplicationThreadNative.asInterface(b);
+            IApplicationThread app = IApplicationThread.Stub.asInterface(b);
             IBinder token = data.readStrongBinder();
             Intent service = Intent.CREATOR.createFromParcel(data);
             String resolvedType = data.readString();
@@ -1210,7 +1210,7 @@
         case FINISH_INSTRUMENTATION_TRANSACTION: {
             data.enforceInterface(IActivityManager.descriptor);
             IBinder b = data.readStrongBinder();
-            IApplicationThread app = ApplicationThreadNative.asInterface(b);
+            IApplicationThread app = IApplicationThread.Stub.asInterface(b);
             int resultCode = data.readInt();
             Bundle results = data.readBundle();
             finishInstrumentation(app, resultCode, results);
@@ -1421,7 +1421,7 @@
         case GRANT_URI_PERMISSION_TRANSACTION: {
             data.enforceInterface(IActivityManager.descriptor);
             IBinder b = data.readStrongBinder();
-            IApplicationThread app = ApplicationThreadNative.asInterface(b);
+            IApplicationThread app = IApplicationThread.Stub.asInterface(b);
             String targetPkg = data.readString();
             Uri uri = Uri.CREATOR.createFromParcel(data);
             int mode = data.readInt();
@@ -1434,7 +1434,7 @@
         case REVOKE_URI_PERMISSION_TRANSACTION: {
             data.enforceInterface(IActivityManager.descriptor);
             IBinder b = data.readStrongBinder();
-            IApplicationThread app = ApplicationThreadNative.asInterface(b);
+            IApplicationThread app = IApplicationThread.Stub.asInterface(b);
             Uri uri = Uri.CREATOR.createFromParcel(data);
             int mode = data.readInt();
             int userId = data.readInt();
@@ -1497,7 +1497,7 @@
         case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
             data.enforceInterface(IActivityManager.descriptor);
             IBinder b = data.readStrongBinder();
-            IApplicationThread app = ApplicationThreadNative.asInterface(b);
+            IApplicationThread app = IApplicationThread.Stub.asInterface(b);
             boolean waiting = data.readInt() != 0;
             showWaitingForDebugger(app, waiting);
             reply.writeNoException();
@@ -2061,7 +2061,7 @@
         {
             data.enforceInterface(IActivityManager.descriptor);
             IBinder b = data.readStrongBinder();
-            IApplicationThread app = ApplicationThreadNative.asInterface(b);
+            IApplicationThread app = IApplicationThread.Stub.asInterface(b);
             String callingPackage = data.readString();
             Intent[] intents = data.createTypedArray(Intent.CREATOR);
             String[] resolvedTypes = data.createStringArray();
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 3a8b6c7..fbbfec3 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -647,7 +647,7 @@
 
     private native void dumpGraphicsInfo(FileDescriptor fd);
 
-    private class ApplicationThread extends ApplicationThreadNative {
+    private class ApplicationThread extends IApplicationThread.Stub {
         private static final String DB_INFO_FORMAT = "  %8s %8s %14s %14s  %s";
 
         private int mLastProcessState = -1;
@@ -859,7 +859,7 @@
                 IUiAutomationConnection instrumentationUiConnection, int debugMode,
                 boolean enableBinderTracking, boolean trackAllocation,
                 boolean isRestrictedBackupMode, boolean persistent, Configuration config,
-                CompatibilityInfo compatInfo, Map<String, IBinder> services, Bundle coreSettings,
+                CompatibilityInfo compatInfo, Map services, Bundle coreSettings,
                 String buildSerial) {
 
             if (services != null) {
@@ -929,15 +929,17 @@
             mH.sendMessage(mH.obtainMessage(H.GC_WHEN_IDLE));
         }
 
-        public void dumpService(FileDescriptor fd, IBinder servicetoken, String[] args) {
+        public void dumpService(ParcelFileDescriptor pfd, IBinder servicetoken, String[] args) {
             DumpComponentInfo data = new DumpComponentInfo();
             try {
-                data.fd = ParcelFileDescriptor.dup(fd);
+                data.fd = pfd.dup();
                 data.token = servicetoken;
                 data.args = args;
                 sendMessage(H.DUMP_SERVICE, data, 0, 0, true /*async*/);
             } catch (IOException e) {
                 Slog.w(TAG, "dumpService failed", e);
+            } finally {
+                IoUtils.closeQuietly(pfd);
             }
         }
 
@@ -996,43 +998,48 @@
             sendMessage(H.SCHEDULE_CRASH, msg);
         }
 
-        public void dumpActivity(FileDescriptor fd, IBinder activitytoken,
+        public void dumpActivity(ParcelFileDescriptor pfd, IBinder activitytoken,
                 String prefix, String[] args) {
             DumpComponentInfo data = new DumpComponentInfo();
             try {
-                data.fd = ParcelFileDescriptor.dup(fd);
+                data.fd = pfd.dup();
                 data.token = activitytoken;
                 data.prefix = prefix;
                 data.args = args;
                 sendMessage(H.DUMP_ACTIVITY, data, 0, 0, true /*async*/);
             } catch (IOException e) {
                 Slog.w(TAG, "dumpActivity failed", e);
+            } finally {
+                IoUtils.closeQuietly(pfd);
             }
         }
 
-        public void dumpProvider(FileDescriptor fd, IBinder providertoken,
+        public void dumpProvider(ParcelFileDescriptor pfd, IBinder providertoken,
                 String[] args) {
             DumpComponentInfo data = new DumpComponentInfo();
             try {
-                data.fd = ParcelFileDescriptor.dup(fd);
+                data.fd = pfd.dup();
                 data.token = providertoken;
                 data.args = args;
                 sendMessage(H.DUMP_PROVIDER, data, 0, 0, true /*async*/);
             } catch (IOException e) {
                 Slog.w(TAG, "dumpProvider failed", e);
+            } finally {
+                IoUtils.closeQuietly(pfd);
             }
         }
 
         @Override
-        public void dumpMemInfo(FileDescriptor fd, Debug.MemoryInfo mem, boolean checkin,
+        public void dumpMemInfo(ParcelFileDescriptor pfd, Debug.MemoryInfo mem, boolean checkin,
                 boolean dumpFullInfo, boolean dumpDalvik, boolean dumpSummaryOnly,
                 boolean dumpUnreachable, String[] args) {
-            FileOutputStream fout = new FileOutputStream(fd);
+            FileOutputStream fout = new FileOutputStream(pfd.getFileDescriptor());
             PrintWriter pw = new FastPrintWriter(fout);
             try {
                 dumpMemInfo(pw, mem, checkin, dumpFullInfo, dumpDalvik, dumpSummaryOnly, dumpUnreachable);
             } finally {
                 pw.flush();
+                IoUtils.closeQuietly(pfd);
             }
         }
 
@@ -1175,44 +1182,49 @@
         }
 
         @Override
-        public void dumpGfxInfo(FileDescriptor fd, String[] args) {
-            dumpGraphicsInfo(fd);
-            WindowManagerGlobal.getInstance().dumpGfxInfo(fd, args);
+        public void dumpGfxInfo(ParcelFileDescriptor pfd, String[] args) {
+            dumpGraphicsInfo(pfd.getFileDescriptor());
+            WindowManagerGlobal.getInstance().dumpGfxInfo(pfd.getFileDescriptor(), args);
+            IoUtils.closeQuietly(pfd);
         }
 
-        private void dumpDatabaseInfo(FileDescriptor fd, String[] args) {
-            PrintWriter pw = new FastPrintWriter(new FileOutputStream(fd));
+        private void dumpDatabaseInfo(ParcelFileDescriptor pfd, String[] args) {
+            PrintWriter pw = new FastPrintWriter(
+                    new FileOutputStream(pfd.getFileDescriptor()));
             PrintWriterPrinter printer = new PrintWriterPrinter(pw);
             SQLiteDebug.dump(printer, args);
             pw.flush();
         }
 
         @Override
-        public void dumpDbInfo(final FileDescriptor fd, final String[] args) {
+        public void dumpDbInfo(final ParcelFileDescriptor pfd, final String[] args) {
             if (mSystemThread) {
                 // Ensure this invocation is asynchronous to prevent writer waiting if buffer cannot
                 // be consumed. But it must duplicate the file descriptor first, since caller might
                 // be closing it.
                 final ParcelFileDescriptor dup;
                 try {
-                    dup = ParcelFileDescriptor.dup(fd);
+                    dup = pfd.dup();
                 } catch (IOException e) {
-                    Log.w(TAG, "Could not dup FD " + fd.getInt$());
+                    Log.w(TAG, "Could not dup FD " + pfd.getFileDescriptor().getInt$());
                     return;
+                } finally {
+                    IoUtils.closeQuietly(pfd);
                 }
 
                 AsyncTask.THREAD_POOL_EXECUTOR.execute(new Runnable() {
                     @Override
                     public void run() {
                         try {
-                            dumpDatabaseInfo(dup.getFileDescriptor(), args);
+                            dumpDatabaseInfo(dup, args);
                         } finally {
                             IoUtils.closeQuietly(dup);
                         }
                     }
                 });
             } else {
-                dumpDatabaseInfo(fd, args);
+                dumpDatabaseInfo(pfd, args);
+                IoUtils.closeQuietly(pfd);
             }
         }
 
@@ -1251,9 +1263,9 @@
             sendMessage(H.TRANSLUCENT_CONVERSION_COMPLETE, token, drawComplete ? 1 : 0);
         }
 
-        public void scheduleOnNewActivityOptions(IBinder token, ActivityOptions options) {
+        public void scheduleOnNewActivityOptions(IBinder token, Bundle options) {
             sendMessage(H.ON_NEW_ACTIVITY_OPTIONS,
-                    new Pair<IBinder, ActivityOptions>(token, options));
+                    new Pair<IBinder, ActivityOptions>(token, ActivityOptions.fromBundle(options)));
         }
 
         public void setProcessState(int state) {
@@ -1319,10 +1331,12 @@
         }
 
         @Override
-        public void stopBinderTrackingAndDump(FileDescriptor fd) {
+        public void stopBinderTrackingAndDump(ParcelFileDescriptor pfd) {
             try {
-                sendMessage(H.STOP_BINDER_TRACKING_AND_DUMP, ParcelFileDescriptor.dup(fd));
+                sendMessage(H.STOP_BINDER_TRACKING_AND_DUMP, pfd.dup());
             } catch (IOException e) {
+            } finally {
+                IoUtils.closeQuietly(pfd);
             }
         }
 
@@ -3097,8 +3111,8 @@
 
         String classname = data.appInfo.backupAgentName;
         // full backup operation but no app-supplied agent?  use the default implementation
-        if (classname == null && (data.backupMode == IApplicationThread.BACKUP_MODE_FULL
-                || data.backupMode == IApplicationThread.BACKUP_MODE_RESTORE_FULL)) {
+        if (classname == null && (data.backupMode == ApplicationThreadConstants.BACKUP_MODE_FULL
+                || data.backupMode == ApplicationThreadConstants.BACKUP_MODE_RESTORE_FULL)) {
             classname = "android.app.backup.FullBackupAgent";
         }
 
@@ -3130,8 +3144,9 @@
                     // If this is during restore, fail silently; otherwise go
                     // ahead and let the user see the crash.
                     Slog.e(TAG, "Agent threw during creation: " + e);
-                    if (data.backupMode != IApplicationThread.BACKUP_MODE_RESTORE
-                            && data.backupMode != IApplicationThread.BACKUP_MODE_RESTORE_FULL) {
+                    if (data.backupMode != ApplicationThreadConstants.BACKUP_MODE_RESTORE
+                            && data.backupMode !=
+                                    ApplicationThreadConstants.BACKUP_MODE_RESTORE_FULL) {
                         throw e;
                     }
                     // falling through with 'binder' still null
@@ -4904,10 +4919,10 @@
     final void handleDispatchPackageBroadcast(int cmd, String[] packages) {
         boolean hasPkgInfo = false;
         switch (cmd) {
-            case IApplicationThread.PACKAGE_REMOVED:
-            case IApplicationThread.PACKAGE_REMOVED_DONT_KILL:
+            case ApplicationThreadConstants.PACKAGE_REMOVED:
+            case ApplicationThreadConstants.PACKAGE_REMOVED_DONT_KILL:
             {
-                final boolean killApp = cmd == IApplicationThread.PACKAGE_REMOVED;
+                final boolean killApp = cmd == ApplicationThreadConstants.PACKAGE_REMOVED;
                 if (packages == null) {
                     break;
                 }
@@ -4932,7 +4947,7 @@
                 }
                 break;
             }
-            case IApplicationThread.PACKAGE_REPLACED:
+            case ApplicationThreadConstants.PACKAGE_REPLACED:
             {
                 if (packages == null) {
                     break;
@@ -5232,10 +5247,10 @@
             /* ignore */
         }
 
-        if (data.debugMode != IApplicationThread.DEBUG_OFF) {
+        if (data.debugMode != ApplicationThreadConstants.DEBUG_OFF) {
             // XXX should have option to change the port.
             Debug.changeDebugPort(8100);
-            if (data.debugMode == IApplicationThread.DEBUG_WAIT) {
+            if (data.debugMode == ApplicationThreadConstants.DEBUG_WAIT) {
                 Slog.w(TAG, "Application " + data.info.getPackageName()
                       + " is waiting for the debugger on port 8100...");
 
diff --git a/core/java/android/app/ApplicationPackageManager.java b/core/java/android/app/ApplicationPackageManager.java
index 37faa2e..3b3e070 100644
--- a/core/java/android/app/ApplicationPackageManager.java
+++ b/core/java/android/app/ApplicationPackageManager.java
@@ -1381,7 +1381,7 @@
 
     static void handlePackageBroadcast(int cmd, String[] pkgList, boolean hasPkgInfo) {
         boolean immediateGc = false;
-        if (cmd == IApplicationThread.EXTERNAL_STORAGE_UNAVAILABLE) {
+        if (cmd == ApplicationThreadConstants.EXTERNAL_STORAGE_UNAVAILABLE) {
             immediateGc = true;
         }
         if (pkgList != null && (pkgList.length > 0)) {
diff --git a/core/java/android/app/ApplicationThreadConstants.java b/core/java/android/app/ApplicationThreadConstants.java
new file mode 100644
index 0000000..1fa670f
--- /dev/null
+++ b/core/java/android/app/ApplicationThreadConstants.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.app;
+
+/**
+ * @hide
+ */
+public final class ApplicationThreadConstants {
+    public static final int BACKUP_MODE_INCREMENTAL = 0;
+    public static final int BACKUP_MODE_FULL = 1;
+    public static final int BACKUP_MODE_RESTORE = 2;
+    public static final int BACKUP_MODE_RESTORE_FULL = 3;
+
+    public static final int DEBUG_OFF = 0;
+    public static final int DEBUG_ON = 1;
+    public static final int DEBUG_WAIT = 2;
+
+    // the package has been removed, clean up internal references
+    public static final int PACKAGE_REMOVED = 0;
+    public static final int EXTERNAL_STORAGE_UNAVAILABLE = 1;
+    // the package is being modified in-place, don't kill it and retain references to it
+    public static final int PACKAGE_REMOVED_DONT_KILL = 2;
+    // a previously removed package was replaced with a new version [eg. upgrade, split added, ...]
+    public static final int PACKAGE_REPLACED = 3;
+}
\ No newline at end of file
diff --git a/core/java/android/app/ApplicationThreadNative.java b/core/java/android/app/ApplicationThreadNative.java
deleted file mode 100644
index 12e527e..0000000
--- a/core/java/android/app/ApplicationThreadNative.java
+++ /dev/null
@@ -1,1544 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.app;
-
-import android.content.ComponentName;
-import android.content.Intent;
-import android.content.IIntentReceiver;
-import android.content.pm.ActivityInfo;
-import android.content.pm.ApplicationInfo;
-import android.content.pm.ProviderInfo;
-import android.content.pm.ServiceInfo;
-import android.content.res.CompatibilityInfo;
-import android.content.res.Configuration;
-import android.net.Uri;
-import android.os.Binder;
-import android.os.Bundle;
-import android.os.Debug;
-import android.os.Parcelable;
-import android.os.PersistableBundle;
-import android.os.RemoteException;
-import android.os.IBinder;
-import android.os.Parcel;
-import android.os.ParcelFileDescriptor;
-import android.os.TransactionTooLargeException;
-import android.util.Log;
-
-import com.android.internal.app.IVoiceInteractor;
-import com.android.internal.content.ReferrerIntent;
-
-import java.io.FileDescriptor;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/** {@hide} */
-public abstract class ApplicationThreadNative extends Binder
-        implements IApplicationThread {
-    /**
-     * Cast a Binder object into an application thread interface, generating
-     * a proxy if needed.
-     */
-    static public IApplicationThread asInterface(IBinder obj) {
-        if (obj == null) {
-            return null;
-        }
-        IApplicationThread in =
-            (IApplicationThread)obj.queryLocalInterface(descriptor);
-        if (in != null) {
-            return in;
-        }
-
-        return new ApplicationThreadProxy(obj);
-    }
-
-    public ApplicationThreadNative() {
-        attachInterface(this, descriptor);
-    }
-
-    @Override
-    public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
-            throws RemoteException {
-        switch (code) {
-        case SCHEDULE_PAUSE_ACTIVITY_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            IBinder b = data.readStrongBinder();
-            boolean finished = data.readInt() != 0;
-            boolean userLeaving = data.readInt() != 0;
-            int configChanges = data.readInt();
-            boolean dontReport = data.readInt() != 0;
-            schedulePauseActivity(b, finished, userLeaving, configChanges, dontReport);
-            return true;
-        }
-
-        case SCHEDULE_STOP_ACTIVITY_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            IBinder b = data.readStrongBinder();
-            boolean show = data.readInt() != 0;
-            int configChanges = data.readInt();
-            scheduleStopActivity(b, show, configChanges);
-            return true;
-        }
-
-        case SCHEDULE_WINDOW_VISIBILITY_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            IBinder b = data.readStrongBinder();
-            boolean show = data.readInt() != 0;
-            scheduleWindowVisibility(b, show);
-            return true;
-        }
-
-        case SCHEDULE_SLEEPING_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            IBinder b = data.readStrongBinder();
-            boolean sleeping = data.readInt() != 0;
-            scheduleSleeping(b, sleeping);
-            return true;
-        }
-
-        case SCHEDULE_RESUME_ACTIVITY_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            IBinder b = data.readStrongBinder();
-            int procState = data.readInt();
-            boolean isForward = data.readInt() != 0;
-            Bundle resumeArgs = data.readBundle();
-            scheduleResumeActivity(b, procState, isForward, resumeArgs);
-            return true;
-        }
-
-        case SCHEDULE_SEND_RESULT_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            IBinder b = data.readStrongBinder();
-            List<ResultInfo> ri = data.createTypedArrayList(ResultInfo.CREATOR);
-            scheduleSendResult(b, ri);
-            return true;
-        }
-
-        case SCHEDULE_LAUNCH_ACTIVITY_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            Intent intent = Intent.CREATOR.createFromParcel(data);
-            IBinder b = data.readStrongBinder();
-            int ident = data.readInt();
-            ActivityInfo info = ActivityInfo.CREATOR.createFromParcel(data);
-            Configuration curConfig = Configuration.CREATOR.createFromParcel(data);
-            Configuration overrideConfig = null;
-            if (data.readInt() != 0) {
-                overrideConfig = Configuration.CREATOR.createFromParcel(data);
-            }
-            CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data);
-            String referrer = data.readString();
-            IVoiceInteractor voiceInteractor = IVoiceInteractor.Stub.asInterface(
-                    data.readStrongBinder());
-            int procState = data.readInt();
-            Bundle state = data.readBundle();
-            PersistableBundle persistentState = data.readPersistableBundle();
-            List<ResultInfo> ri = data.createTypedArrayList(ResultInfo.CREATOR);
-            List<ReferrerIntent> pi = data.createTypedArrayList(ReferrerIntent.CREATOR);
-            boolean notResumed = data.readInt() != 0;
-            boolean isForward = data.readInt() != 0;
-            ProfilerInfo profilerInfo = data.readInt() != 0
-                    ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
-            scheduleLaunchActivity(intent, b, ident, info, curConfig, overrideConfig, compatInfo,
-                    referrer, voiceInteractor, procState, state, persistentState, ri, pi,
-                    notResumed, isForward, profilerInfo);
-            return true;
-        }
-
-        case SCHEDULE_RELAUNCH_ACTIVITY_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            IBinder b = data.readStrongBinder();
-            List<ResultInfo> ri = data.createTypedArrayList(ResultInfo.CREATOR);
-            List<ReferrerIntent> pi = data.createTypedArrayList(ReferrerIntent.CREATOR);
-            int configChanges = data.readInt();
-            boolean notResumed = data.readInt() != 0;
-            Configuration config = Configuration.CREATOR.createFromParcel(data);
-            Configuration overrideConfig = null;
-            if (data.readInt() != 0) {
-                overrideConfig = Configuration.CREATOR.createFromParcel(data);
-            }
-            boolean preserveWindows = data.readInt() == 1;
-            scheduleRelaunchActivity(b, ri, pi, configChanges, notResumed, config, overrideConfig,
-                    preserveWindows);
-            return true;
-        }
-
-        case SCHEDULE_NEW_INTENT_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            List<ReferrerIntent> pi = data.createTypedArrayList(ReferrerIntent.CREATOR);
-            IBinder b = data.readStrongBinder();
-            final boolean andPause = data.readInt() == 1;
-            scheduleNewIntent(pi, b, andPause);
-            return true;
-        }
-
-        case SCHEDULE_FINISH_ACTIVITY_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            IBinder b = data.readStrongBinder();
-            boolean finishing = data.readInt() != 0;
-            int configChanges = data.readInt();
-            scheduleDestroyActivity(b, finishing, configChanges);
-            return true;
-        }
-
-        case SCHEDULE_RECEIVER_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            Intent intent = Intent.CREATOR.createFromParcel(data);
-            ActivityInfo info = ActivityInfo.CREATOR.createFromParcel(data);
-            CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data);
-            int resultCode = data.readInt();
-            String resultData = data.readString();
-            Bundle resultExtras = data.readBundle();
-            boolean sync = data.readInt() != 0;
-            int sendingUser = data.readInt();
-            int processState = data.readInt();
-            scheduleReceiver(intent, info, compatInfo, resultCode, resultData,
-                    resultExtras, sync, sendingUser, processState);
-            return true;
-        }
-
-        case SCHEDULE_CREATE_SERVICE_TRANSACTION: {
-            data.enforceInterface(IApplicationThread.descriptor);
-            IBinder token = data.readStrongBinder();
-            ServiceInfo info = ServiceInfo.CREATOR.createFromParcel(data);
-            CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data);
-            int processState = data.readInt();
-            scheduleCreateService(token, info, compatInfo, processState);
-            return true;
-        }
-
-        case SCHEDULE_BIND_SERVICE_TRANSACTION: {
-            data.enforceInterface(IApplicationThread.descriptor);
-            IBinder token = data.readStrongBinder();
-            Intent intent = Intent.CREATOR.createFromParcel(data);
-            boolean rebind = data.readInt() != 0;
-            int processState = data.readInt();
-            scheduleBindService(token, intent, rebind, processState);
-            return true;
-        }
-
-        case SCHEDULE_UNBIND_SERVICE_TRANSACTION: {
-            data.enforceInterface(IApplicationThread.descriptor);
-            IBinder token = data.readStrongBinder();
-            Intent intent = Intent.CREATOR.createFromParcel(data);
-            scheduleUnbindService(token, intent);
-            return true;
-        }
-
-        case SCHEDULE_SERVICE_ARGS_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            IBinder token = data.readStrongBinder();
-            boolean taskRemoved = data.readInt() != 0;
-            int startId = data.readInt();
-            int fl = data.readInt();
-            Intent args;
-            if (data.readInt() != 0) {
-                args = Intent.CREATOR.createFromParcel(data);
-            } else {
-                args = null;
-            }
-            scheduleServiceArgs(token, taskRemoved, startId, fl, args);
-            return true;
-        }
-
-        case SCHEDULE_STOP_SERVICE_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            IBinder token = data.readStrongBinder();
-            scheduleStopService(token);
-            return true;
-        }
-
-        case BIND_APPLICATION_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            String packageName = data.readString();
-            ApplicationInfo info =
-                ApplicationInfo.CREATOR.createFromParcel(data);
-            List<ProviderInfo> providers =
-                data.createTypedArrayList(ProviderInfo.CREATOR);
-            ComponentName testName = (data.readInt() != 0)
-                ? new ComponentName(data) : null;
-            ProfilerInfo profilerInfo = data.readInt() != 0
-                    ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
-            Bundle testArgs = data.readBundle();
-            IBinder binder = data.readStrongBinder();
-            IInstrumentationWatcher testWatcher = IInstrumentationWatcher.Stub.asInterface(binder);
-            binder = data.readStrongBinder();
-            IUiAutomationConnection uiAutomationConnection =
-                    IUiAutomationConnection.Stub.asInterface(binder);
-            int testMode = data.readInt();
-            boolean enableBinderTracking = data.readInt() != 0;
-            boolean trackAllocation = data.readInt() != 0;
-            boolean restrictedBackupMode = (data.readInt() != 0);
-            boolean persistent = (data.readInt() != 0);
-            Configuration config = Configuration.CREATOR.createFromParcel(data);
-            CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data);
-            HashMap<String, IBinder> services = data.readHashMap(null);
-            Bundle coreSettings = data.readBundle();
-            String buildSerial = data.readString();
-            bindApplication(packageName, info, providers, testName, profilerInfo, testArgs,
-                    testWatcher, uiAutomationConnection, testMode, enableBinderTracking,
-                    trackAllocation, restrictedBackupMode, persistent, config, compatInfo, services,
-                    coreSettings, buildSerial);
-            return true;
-        }
-
-        case SCHEDULE_EXIT_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            scheduleExit();
-            return true;
-        }
-
-        case SCHEDULE_SUICIDE_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            scheduleSuicide();
-            return true;
-        }
-
-        case SCHEDULE_CONFIGURATION_CHANGED_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            Configuration config = Configuration.CREATOR.createFromParcel(data);
-            scheduleConfigurationChanged(config);
-            return true;
-        }
-
-        case UPDATE_TIME_ZONE_TRANSACTION: {
-            data.enforceInterface(IApplicationThread.descriptor);
-            updateTimeZone();
-            return true;
-        }
-
-        case CLEAR_DNS_CACHE_TRANSACTION: {
-            data.enforceInterface(IApplicationThread.descriptor);
-            clearDnsCache();
-            return true;
-        }
-
-        case SET_HTTP_PROXY_TRANSACTION: {
-            data.enforceInterface(IApplicationThread.descriptor);
-            final String proxy = data.readString();
-            final String port = data.readString();
-            final String exclList = data.readString();
-            final Uri pacFileUrl = Uri.CREATOR.createFromParcel(data);
-            setHttpProxy(proxy, port, exclList, pacFileUrl);
-            return true;
-        }
-
-        case PROCESS_IN_BACKGROUND_TRANSACTION: {
-            data.enforceInterface(IApplicationThread.descriptor);
-            processInBackground();
-            return true;
-        }
-
-        case DUMP_SERVICE_TRANSACTION: {
-            data.enforceInterface(IApplicationThread.descriptor);
-            ParcelFileDescriptor fd = data.readFileDescriptor();
-            final IBinder service = data.readStrongBinder();
-            final String[] args = data.readStringArray();
-            if (fd != null) {
-                dumpService(fd.getFileDescriptor(), service, args);
-                try {
-                    fd.close();
-                } catch (IOException e) {
-                }
-            }
-            return true;
-        }
-
-        case DUMP_PROVIDER_TRANSACTION: {
-            data.enforceInterface(IApplicationThread.descriptor);
-            ParcelFileDescriptor fd = data.readFileDescriptor();
-            final IBinder service = data.readStrongBinder();
-            final String[] args = data.readStringArray();
-            if (fd != null) {
-                dumpProvider(fd.getFileDescriptor(), service, args);
-                try {
-                    fd.close();
-                } catch (IOException e) {
-                }
-            }
-            return true;
-        }
-
-        case SCHEDULE_REGISTERED_RECEIVER_TRANSACTION: {
-            data.enforceInterface(IApplicationThread.descriptor);
-            IIntentReceiver receiver = IIntentReceiver.Stub.asInterface(
-                    data.readStrongBinder());
-            Intent intent = Intent.CREATOR.createFromParcel(data);
-            int resultCode = data.readInt();
-            String dataStr = data.readString();
-            Bundle extras = data.readBundle();
-            boolean ordered = data.readInt() != 0;
-            boolean sticky = data.readInt() != 0;
-            int sendingUser = data.readInt();
-            int processState = data.readInt();
-            scheduleRegisteredReceiver(receiver, intent,
-                    resultCode, dataStr, extras, ordered, sticky, sendingUser, processState);
-            return true;
-        }
-
-        case SCHEDULE_LOW_MEMORY_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            scheduleLowMemory();
-            return true;
-        }
-
-        case SCHEDULE_ACTIVITY_CONFIGURATION_CHANGED_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            IBinder b = data.readStrongBinder();
-            Configuration overrideConfig = null;
-            if (data.readInt() != 0) {
-                overrideConfig = Configuration.CREATOR.createFromParcel(data);
-            }
-            final boolean reportToActivity = data.readInt() == 1;
-            scheduleActivityConfigurationChanged(b, overrideConfig, reportToActivity);
-            return true;
-        }
-
-        case SCHEDULE_LOCAL_VOICE_INTERACTION_STARTED_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            IBinder token = data.readStrongBinder();
-            IVoiceInteractor voiceInteractor = IVoiceInteractor.Stub.asInterface(
-                    data.readStrongBinder());
-            scheduleLocalVoiceInteractionStarted(token, voiceInteractor);
-            return true;
-        }
-
-        case PROFILER_CONTROL_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            boolean start = data.readInt() != 0;
-            int profileType = data.readInt();
-            ProfilerInfo profilerInfo = data.readInt() != 0
-                    ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
-            profilerControl(start, profilerInfo, profileType);
-            return true;
-        }
-
-        case SET_SCHEDULING_GROUP_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            int group = data.readInt();
-            setSchedulingGroup(group);
-            return true;
-        }
-
-        case SCHEDULE_CREATE_BACKUP_AGENT_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            ApplicationInfo appInfo = ApplicationInfo.CREATOR.createFromParcel(data);
-            CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data);
-            int backupMode = data.readInt();
-            scheduleCreateBackupAgent(appInfo, compatInfo, backupMode);
-            return true;
-        }
-
-        case SCHEDULE_DESTROY_BACKUP_AGENT_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            ApplicationInfo appInfo = ApplicationInfo.CREATOR.createFromParcel(data);
-            CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data);
-            scheduleDestroyBackupAgent(appInfo, compatInfo);
-            return true;
-        }
-
-        case DISPATCH_PACKAGE_BROADCAST_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            int cmd = data.readInt();
-            String[] packages = data.readStringArray();
-            dispatchPackageBroadcast(cmd, packages);
-            return true;
-        }
-
-        case SCHEDULE_CRASH_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            String msg = data.readString();
-            scheduleCrash(msg);
-            return true;
-        }
-
-        case DUMP_HEAP_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            boolean managed = data.readInt() != 0;
-            String path = data.readString();
-            ParcelFileDescriptor fd = data.readInt() != 0
-                    ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
-            dumpHeap(managed, path, fd);
-            return true;
-        }
-
-        case DUMP_ACTIVITY_TRANSACTION: {
-            data.enforceInterface(IApplicationThread.descriptor);
-            ParcelFileDescriptor fd = data.readFileDescriptor();
-            final IBinder activity = data.readStrongBinder();
-            final String prefix = data.readString();
-            final String[] args = data.readStringArray();
-            if (fd != null) {
-                dumpActivity(fd.getFileDescriptor(), activity, prefix, args);
-                try {
-                    fd.close();
-                } catch (IOException e) {
-                }
-            }
-            return true;
-        }
-
-        case SET_CORE_SETTINGS_TRANSACTION: {
-            data.enforceInterface(IApplicationThread.descriptor);
-            Bundle settings = data.readBundle();
-            setCoreSettings(settings);
-            return true;
-        }
-
-        case UPDATE_PACKAGE_COMPATIBILITY_INFO_TRANSACTION: {
-            data.enforceInterface(IApplicationThread.descriptor);
-            String pkg = data.readString();
-            CompatibilityInfo compat = CompatibilityInfo.CREATOR.createFromParcel(data);
-            updatePackageCompatibilityInfo(pkg, compat);
-            return true;
-        }
-
-        case SCHEDULE_TRIM_MEMORY_TRANSACTION: {
-            data.enforceInterface(IApplicationThread.descriptor);
-            int level = data.readInt();
-            scheduleTrimMemory(level);
-            return true;
-        }
-
-        case DUMP_MEM_INFO_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            ParcelFileDescriptor fd = data.readFileDescriptor();
-            Debug.MemoryInfo mi = Debug.MemoryInfo.CREATOR.createFromParcel(data);
-            boolean checkin = data.readInt() != 0;
-            boolean dumpInfo = data.readInt() != 0;
-            boolean dumpDalvik = data.readInt() != 0;
-            boolean dumpSummaryOnly = data.readInt() != 0;
-            boolean dumpUnreachable = data.readInt() != 0;
-            String[] args = data.readStringArray();
-            if (fd != null) {
-                try {
-                    dumpMemInfo(fd.getFileDescriptor(), mi, checkin, dumpInfo,
-                            dumpDalvik, dumpSummaryOnly, dumpUnreachable, args);
-                } finally {
-                    try {
-                        fd.close();
-                    } catch (IOException e) {
-                        // swallowed, not propagated back to the caller
-                    }
-                }
-            }
-            reply.writeNoException();
-            return true;
-        }
-
-        case DUMP_GFX_INFO_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            ParcelFileDescriptor fd = data.readFileDescriptor();
-            String[] args = data.readStringArray();
-            if (fd != null) {
-                try {
-                    dumpGfxInfo(fd.getFileDescriptor(), args);
-                } finally {
-                    try {
-                        fd.close();
-                    } catch (IOException e) {
-                        // swallowed, not propagated back to the caller
-                    }
-                }
-            }
-            reply.writeNoException();
-            return true;
-        }
-
-        case DUMP_DB_INFO_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            ParcelFileDescriptor fd = data.readFileDescriptor();
-            String[] args = data.readStringArray();
-            if (fd != null) {
-                try {
-                    dumpDbInfo(fd.getFileDescriptor(), args);
-                } finally {
-                    try {
-                        fd.close();
-                    } catch (IOException e) {
-                        // swallowed, not propagated back to the caller
-                    }
-                }
-            }
-            reply.writeNoException();
-            return true;
-        }
-
-        case UNSTABLE_PROVIDER_DIED_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            IBinder provider = data.readStrongBinder();
-            unstableProviderDied(provider);
-            reply.writeNoException();
-            return true;
-        }
-
-        case REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            IBinder activityToken = data.readStrongBinder();
-            IBinder requestToken = data.readStrongBinder();
-            int requestType = data.readInt();
-            int sessionId = data.readInt();
-            requestAssistContextExtras(activityToken, requestToken, requestType, sessionId);
-            reply.writeNoException();
-            return true;
-        }
-
-        case SCHEDULE_TRANSLUCENT_CONVERSION_COMPLETE_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            IBinder token = data.readStrongBinder();
-            boolean timeout = data.readInt() == 1;
-            scheduleTranslucentConversionComplete(token, timeout);
-            reply.writeNoException();
-            return true;
-        }
-
-        case SCHEDULE_ON_NEW_ACTIVITY_OPTIONS_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            IBinder token = data.readStrongBinder();
-            ActivityOptions options = new ActivityOptions(data.readBundle());
-            scheduleOnNewActivityOptions(token, options);
-            reply.writeNoException();
-            return true;
-        }
-
-        case SET_PROCESS_STATE_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            int state = data.readInt();
-            setProcessState(state);
-            reply.writeNoException();
-            return true;
-        }
-
-        case SCHEDULE_INSTALL_PROVIDER_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            ProviderInfo provider = ProviderInfo.CREATOR.createFromParcel(data);
-            scheduleInstallProvider(provider);
-            reply.writeNoException();
-            return true;
-        }
-
-        case UPDATE_TIME_PREFS_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            byte is24Hour = data.readByte();
-            updateTimePrefs(is24Hour == (byte) 1);
-            reply.writeNoException();
-            return true;
-        }
-
-        case CANCEL_VISIBLE_BEHIND_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            IBinder token = data.readStrongBinder();
-            scheduleCancelVisibleBehind(token);
-            reply.writeNoException();
-            return true;
-        }
-
-        case BACKGROUND_VISIBLE_BEHIND_CHANGED_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            IBinder token = data.readStrongBinder();
-            boolean enabled = data.readInt() > 0;
-            scheduleBackgroundVisibleBehindChanged(token, enabled);
-            reply.writeNoException();
-            return true;
-        }
-
-        case ENTER_ANIMATION_COMPLETE_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            IBinder token = data.readStrongBinder();
-            scheduleEnterAnimationComplete(token);
-            reply.writeNoException();
-            return true;
-        }
-
-        case NOTIFY_CLEARTEXT_NETWORK_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            final byte[] firstPacket = data.createByteArray();
-            notifyCleartextNetwork(firstPacket);
-            reply.writeNoException();
-            return true;
-        }
-
-        case START_BINDER_TRACKING_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            startBinderTracking();
-            return true;
-        }
-
-        case STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            ParcelFileDescriptor fd = data.readFileDescriptor();
-            if (fd != null) {
-                stopBinderTrackingAndDump(fd.getFileDescriptor());
-                try {
-                    fd.close();
-                } catch (IOException e) {
-                }
-            }
-            return true;
-        }
-
-        case SCHEDULE_MULTI_WINDOW_CHANGED_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            final IBinder b = data.readStrongBinder();
-            final boolean inMultiWindow = data.readInt() != 0;
-            scheduleMultiWindowModeChanged(b, inMultiWindow);
-            return true;
-        }
-
-        case SCHEDULE_PICTURE_IN_PICTURE_CHANGED_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            final IBinder b = data.readStrongBinder();
-            final boolean inPip = data.readInt() != 0;
-            schedulePictureInPictureModeChanged(b, inPip);
-            return true;
-        }
-        case HANDLE_TRUST_STORAGE_UPDATE_TRANSACTION:
-        {
-            data.enforceInterface(IApplicationThread.descriptor);
-            handleTrustStorageUpdate();
-            return true;
-        }
-
-        }
-
-        return super.onTransact(code, data, reply, flags);
-    }
-
-    public IBinder asBinder()
-    {
-        return this;
-    }
-}
-
-class ApplicationThreadProxy implements IApplicationThread {
-    private final IBinder mRemote;
-
-    public ApplicationThreadProxy(IBinder remote) {
-        mRemote = remote;
-    }
-
-    public final IBinder asBinder() {
-        return mRemote;
-    }
-
-    public final void schedulePauseActivity(IBinder token, boolean finished,
-            boolean userLeaving, int configChanges, boolean dontReport) throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeStrongBinder(token);
-        data.writeInt(finished ? 1 : 0);
-        data.writeInt(userLeaving ? 1 :0);
-        data.writeInt(configChanges);
-        data.writeInt(dontReport ? 1 : 0);
-        mRemote.transact(SCHEDULE_PAUSE_ACTIVITY_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    public final void scheduleStopActivity(IBinder token, boolean showWindow,
-            int configChanges) throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeStrongBinder(token);
-        data.writeInt(showWindow ? 1 : 0);
-        data.writeInt(configChanges);
-        mRemote.transact(SCHEDULE_STOP_ACTIVITY_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    public final void scheduleWindowVisibility(IBinder token,
-            boolean showWindow) throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeStrongBinder(token);
-        data.writeInt(showWindow ? 1 : 0);
-        mRemote.transact(SCHEDULE_WINDOW_VISIBILITY_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    public final void scheduleSleeping(IBinder token,
-            boolean sleeping) throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeStrongBinder(token);
-        data.writeInt(sleeping ? 1 : 0);
-        mRemote.transact(SCHEDULE_SLEEPING_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    public final void scheduleResumeActivity(IBinder token, int procState, boolean isForward,
-            Bundle resumeArgs)
-            throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeStrongBinder(token);
-        data.writeInt(procState);
-        data.writeInt(isForward ? 1 : 0);
-        data.writeBundle(resumeArgs);
-        mRemote.transact(SCHEDULE_RESUME_ACTIVITY_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    public final void scheduleSendResult(IBinder token, List<ResultInfo> results)
-            throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeStrongBinder(token);
-        data.writeTypedList(results);
-        mRemote.transact(SCHEDULE_SEND_RESULT_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    public final void scheduleLaunchActivity(Intent intent, IBinder token, int ident,
-            ActivityInfo info, Configuration curConfig, Configuration overrideConfig,
-            CompatibilityInfo compatInfo, String referrer, IVoiceInteractor voiceInteractor,
-            int procState, Bundle state, PersistableBundle persistentState,
-            List<ResultInfo> pendingResults, List<ReferrerIntent> pendingNewIntents,
-            boolean notResumed, boolean isForward, ProfilerInfo profilerInfo) throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        intent.writeToParcel(data, 0);
-        data.writeStrongBinder(token);
-        data.writeInt(ident);
-        info.writeToParcel(data, 0);
-        curConfig.writeToParcel(data, 0);
-        if (overrideConfig != null) {
-            data.writeInt(1);
-            overrideConfig.writeToParcel(data, 0);
-        } else {
-            data.writeInt(0);
-        }
-        compatInfo.writeToParcel(data, 0);
-        data.writeString(referrer);
-        data.writeStrongBinder(voiceInteractor != null ? voiceInteractor.asBinder() : null);
-        data.writeInt(procState);
-        data.writeBundle(state);
-        data.writePersistableBundle(persistentState);
-        data.writeTypedList(pendingResults);
-        data.writeTypedList(pendingNewIntents);
-        data.writeInt(notResumed ? 1 : 0);
-        data.writeInt(isForward ? 1 : 0);
-        if (profilerInfo != null) {
-            data.writeInt(1);
-            profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
-        } else {
-            data.writeInt(0);
-        }
-        mRemote.transact(SCHEDULE_LAUNCH_ACTIVITY_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    public final void scheduleRelaunchActivity(IBinder token,
-            List<ResultInfo> pendingResults, List<ReferrerIntent> pendingNewIntents,
-            int configChanges, boolean notResumed, Configuration config,
-            Configuration overrideConfig, boolean preserveWindow) throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeStrongBinder(token);
-        data.writeTypedList(pendingResults);
-        data.writeTypedList(pendingNewIntents);
-        data.writeInt(configChanges);
-        data.writeInt(notResumed ? 1 : 0);
-        config.writeToParcel(data, 0);
-        if (overrideConfig != null) {
-            data.writeInt(1);
-            overrideConfig.writeToParcel(data, 0);
-        } else {
-            data.writeInt(0);
-        }
-        data.writeInt(preserveWindow ? 1 : 0);
-        mRemote.transact(SCHEDULE_RELAUNCH_ACTIVITY_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    public void scheduleNewIntent(List<ReferrerIntent> intents, IBinder token, boolean andPause)
-            throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeTypedList(intents);
-        data.writeStrongBinder(token);
-        data.writeInt(andPause ? 1 : 0);
-        mRemote.transact(SCHEDULE_NEW_INTENT_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    public final void scheduleDestroyActivity(IBinder token, boolean finishing,
-            int configChanges) throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeStrongBinder(token);
-        data.writeInt(finishing ? 1 : 0);
-        data.writeInt(configChanges);
-        mRemote.transact(SCHEDULE_FINISH_ACTIVITY_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    public final void scheduleReceiver(Intent intent, ActivityInfo info,
-            CompatibilityInfo compatInfo, int resultCode, String resultData,
-            Bundle map, boolean sync, int sendingUser, int processState) throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        intent.writeToParcel(data, 0);
-        info.writeToParcel(data, 0);
-        compatInfo.writeToParcel(data, 0);
-        data.writeInt(resultCode);
-        data.writeString(resultData);
-        data.writeBundle(map);
-        data.writeInt(sync ? 1 : 0);
-        data.writeInt(sendingUser);
-        data.writeInt(processState);
-        mRemote.transact(SCHEDULE_RECEIVER_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    public final void scheduleCreateBackupAgent(ApplicationInfo app,
-            CompatibilityInfo compatInfo, int backupMode) throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        app.writeToParcel(data, 0);
-        compatInfo.writeToParcel(data, 0);
-        data.writeInt(backupMode);
-        mRemote.transact(SCHEDULE_CREATE_BACKUP_AGENT_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    public final void scheduleDestroyBackupAgent(ApplicationInfo app,
-            CompatibilityInfo compatInfo) throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        app.writeToParcel(data, 0);
-        compatInfo.writeToParcel(data, 0);
-        mRemote.transact(SCHEDULE_DESTROY_BACKUP_AGENT_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    public final void scheduleCreateService(IBinder token, ServiceInfo info,
-            CompatibilityInfo compatInfo, int processState) throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeStrongBinder(token);
-        info.writeToParcel(data, 0);
-        compatInfo.writeToParcel(data, 0);
-        data.writeInt(processState);
-        try {
-            mRemote.transact(SCHEDULE_CREATE_SERVICE_TRANSACTION, data, null,
-                    IBinder.FLAG_ONEWAY);
-        } catch (TransactionTooLargeException e) {
-            Log.e("CREATE_SERVICE", "Binder failure starting service; service=" + info);
-            throw e;
-        }
-        data.recycle();
-    }
-
-    public final void scheduleBindService(IBinder token, Intent intent, boolean rebind,
-            int processState) throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeStrongBinder(token);
-        intent.writeToParcel(data, 0);
-        data.writeInt(rebind ? 1 : 0);
-        data.writeInt(processState);
-        mRemote.transact(SCHEDULE_BIND_SERVICE_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    public final void scheduleUnbindService(IBinder token, Intent intent)
-            throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeStrongBinder(token);
-        intent.writeToParcel(data, 0);
-        mRemote.transact(SCHEDULE_UNBIND_SERVICE_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    public final void scheduleServiceArgs(IBinder token, boolean taskRemoved, int startId,
-            int flags, Intent args) throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeStrongBinder(token);
-        data.writeInt(taskRemoved ? 1 : 0);
-        data.writeInt(startId);
-        data.writeInt(flags);
-        if (args != null) {
-            data.writeInt(1);
-            args.writeToParcel(data, 0);
-        } else {
-            data.writeInt(0);
-        }
-        mRemote.transact(SCHEDULE_SERVICE_ARGS_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    public final void scheduleStopService(IBinder token)
-            throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeStrongBinder(token);
-        mRemote.transact(SCHEDULE_STOP_SERVICE_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    @Override
-    public final void bindApplication(String packageName, ApplicationInfo info,
-            List<ProviderInfo> providers, ComponentName testName, ProfilerInfo profilerInfo,
-            Bundle testArgs, IInstrumentationWatcher testWatcher,
-            IUiAutomationConnection uiAutomationConnection, int debugMode,
-            boolean enableBinderTracking, boolean trackAllocation, boolean restrictedBackupMode,
-            boolean persistent, Configuration config, CompatibilityInfo compatInfo,
-            Map<String, IBinder> services, Bundle coreSettings, String buildSerial)
-            throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeString(packageName);
-        info.writeToParcel(data, 0);
-        data.writeTypedList(providers);
-        if (testName == null) {
-            data.writeInt(0);
-        } else {
-            data.writeInt(1);
-            testName.writeToParcel(data, 0);
-        }
-        if (profilerInfo != null) {
-            data.writeInt(1);
-            profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
-        } else {
-            data.writeInt(0);
-        }
-        data.writeBundle(testArgs);
-        data.writeStrongInterface(testWatcher);
-        data.writeStrongInterface(uiAutomationConnection);
-        data.writeInt(debugMode);
-        data.writeInt(enableBinderTracking ? 1 : 0);
-        data.writeInt(trackAllocation ? 1 : 0);
-        data.writeInt(restrictedBackupMode ? 1 : 0);
-        data.writeInt(persistent ? 1 : 0);
-        config.writeToParcel(data, 0);
-        compatInfo.writeToParcel(data, 0);
-        data.writeMap(services);
-        data.writeBundle(coreSettings);
-        data.writeString(buildSerial);
-        mRemote.transact(BIND_APPLICATION_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    public final void scheduleExit() throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        mRemote.transact(SCHEDULE_EXIT_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    public final void scheduleSuicide() throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        mRemote.transact(SCHEDULE_SUICIDE_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    public final void scheduleConfigurationChanged(Configuration config)
-            throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        config.writeToParcel(data, 0);
-        mRemote.transact(SCHEDULE_CONFIGURATION_CHANGED_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    public final void scheduleLocalVoiceInteractionStarted(IBinder token,
-            IVoiceInteractor voiceInteractor) throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeStrongBinder(token);
-        data.writeStrongBinder(voiceInteractor != null ? voiceInteractor.asBinder() : null);
-        mRemote.transact(SCHEDULE_LOCAL_VOICE_INTERACTION_STARTED_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    public void updateTimeZone() throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        mRemote.transact(UPDATE_TIME_ZONE_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    public void clearDnsCache() throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        mRemote.transact(CLEAR_DNS_CACHE_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    public void setHttpProxy(String proxy, String port, String exclList,
-            Uri pacFileUrl) throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeString(proxy);
-        data.writeString(port);
-        data.writeString(exclList);
-        pacFileUrl.writeToParcel(data, 0);
-        mRemote.transact(SET_HTTP_PROXY_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    public void processInBackground() throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        mRemote.transact(PROCESS_IN_BACKGROUND_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    public void dumpService(FileDescriptor fd, IBinder token, String[] args)
-            throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeFileDescriptor(fd);
-        data.writeStrongBinder(token);
-        data.writeStringArray(args);
-        mRemote.transact(DUMP_SERVICE_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    public void dumpProvider(FileDescriptor fd, IBinder token, String[] args)
-            throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeFileDescriptor(fd);
-        data.writeStrongBinder(token);
-        data.writeStringArray(args);
-        mRemote.transact(DUMP_PROVIDER_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    public void scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent,
-            int resultCode, String dataStr, Bundle extras, boolean ordered,
-            boolean sticky, int sendingUser, int processState) throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeStrongBinder(receiver.asBinder());
-        intent.writeToParcel(data, 0);
-        data.writeInt(resultCode);
-        data.writeString(dataStr);
-        data.writeBundle(extras);
-        data.writeInt(ordered ? 1 : 0);
-        data.writeInt(sticky ? 1 : 0);
-        data.writeInt(sendingUser);
-        data.writeInt(processState);
-        mRemote.transact(SCHEDULE_REGISTERED_RECEIVER_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    @Override
-    public final void scheduleLowMemory() throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        mRemote.transact(SCHEDULE_LOW_MEMORY_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    @Override
-    public final void scheduleActivityConfigurationChanged(IBinder token,
-            Configuration overrideConfig, boolean reportToActivity) throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeStrongBinder(token);
-        if (overrideConfig != null) {
-            data.writeInt(1);
-            overrideConfig.writeToParcel(data, 0);
-        } else {
-            data.writeInt(0);
-        }
-        data.writeInt(reportToActivity ? 1 : 0);
-        mRemote.transact(SCHEDULE_ACTIVITY_CONFIGURATION_CHANGED_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    @Override
-    public void profilerControl(boolean start, ProfilerInfo profilerInfo, int profileType)
-            throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeInt(start ? 1 : 0);
-        data.writeInt(profileType);
-        if (profilerInfo != null) {
-            data.writeInt(1);
-            profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
-        } else {
-            data.writeInt(0);
-        }
-        mRemote.transact(PROFILER_CONTROL_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    public void setSchedulingGroup(int group) throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeInt(group);
-        mRemote.transact(SET_SCHEDULING_GROUP_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    public void dispatchPackageBroadcast(int cmd, String[] packages) throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeInt(cmd);
-        data.writeStringArray(packages);
-        mRemote.transact(DISPATCH_PACKAGE_BROADCAST_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    public void scheduleCrash(String msg) throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeString(msg);
-        mRemote.transact(SCHEDULE_CRASH_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    public void dumpHeap(boolean managed, String path,
-            ParcelFileDescriptor fd) throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeInt(managed ? 1 : 0);
-        data.writeString(path);
-        if (fd != null) {
-            data.writeInt(1);
-            fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
-        } else {
-            data.writeInt(0);
-        }
-        mRemote.transact(DUMP_HEAP_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    public void dumpActivity(FileDescriptor fd, IBinder token, String prefix, String[] args)
-            throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeFileDescriptor(fd);
-        data.writeStrongBinder(token);
-        data.writeString(prefix);
-        data.writeStringArray(args);
-        mRemote.transact(DUMP_ACTIVITY_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    public void setCoreSettings(Bundle coreSettings) throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeBundle(coreSettings);
-        mRemote.transact(SET_CORE_SETTINGS_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
-    }
-
-    public void updatePackageCompatibilityInfo(String pkg, CompatibilityInfo info)
-            throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeString(pkg);
-        info.writeToParcel(data, 0);
-        mRemote.transact(UPDATE_PACKAGE_COMPATIBILITY_INFO_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-    }
-
-    public void scheduleTrimMemory(int level) throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeInt(level);
-        mRemote.transact(SCHEDULE_TRIM_MEMORY_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    public void dumpMemInfo(FileDescriptor fd, Debug.MemoryInfo mem, boolean checkin,
-            boolean dumpInfo, boolean dumpDalvik, boolean dumpSummaryOnly,
-            boolean dumpUnreachable, String[] args) throws RemoteException {
-        Parcel data = Parcel.obtain();
-        Parcel reply = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeFileDescriptor(fd);
-        mem.writeToParcel(data, 0);
-        data.writeInt(checkin ? 1 : 0);
-        data.writeInt(dumpInfo ? 1 : 0);
-        data.writeInt(dumpDalvik ? 1 : 0);
-        data.writeInt(dumpSummaryOnly ? 1 : 0);
-        data.writeInt(dumpUnreachable ? 1 : 0);
-        data.writeStringArray(args);
-        mRemote.transact(DUMP_MEM_INFO_TRANSACTION, data, reply, 0);
-        reply.readException();
-        data.recycle();
-        reply.recycle();
-    }
-
-    public void dumpGfxInfo(FileDescriptor fd, String[] args) throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeFileDescriptor(fd);
-        data.writeStringArray(args);
-        mRemote.transact(DUMP_GFX_INFO_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    public void dumpDbInfo(FileDescriptor fd, String[] args) throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeFileDescriptor(fd);
-        data.writeStringArray(args);
-        mRemote.transact(DUMP_DB_INFO_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    @Override
-    public void unstableProviderDied(IBinder provider) throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeStrongBinder(provider);
-        mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    @Override
-    public void requestAssistContextExtras(IBinder activityToken, IBinder requestToken,
-            int requestType, int sessionId) throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeStrongBinder(activityToken);
-        data.writeStrongBinder(requestToken);
-        data.writeInt(requestType);
-        data.writeInt(sessionId);
-        mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    @Override
-    public void scheduleTranslucentConversionComplete(IBinder token, boolean timeout)
-            throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeStrongBinder(token);
-        data.writeInt(timeout ? 1 : 0);
-        mRemote.transact(SCHEDULE_TRANSLUCENT_CONVERSION_COMPLETE_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    @Override
-    public void scheduleOnNewActivityOptions(IBinder token, ActivityOptions options)
-            throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeStrongBinder(token);
-        data.writeBundle(options == null ? null : options.toBundle());
-        mRemote.transact(SCHEDULE_ON_NEW_ACTIVITY_OPTIONS_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    @Override
-    public void setProcessState(int state) throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeInt(state);
-        mRemote.transact(SET_PROCESS_STATE_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    @Override
-    public void scheduleInstallProvider(ProviderInfo provider) throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        provider.writeToParcel(data, 0);
-        mRemote.transact(SCHEDULE_INSTALL_PROVIDER_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    @Override
-    public void updateTimePrefs(boolean is24Hour) throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeByte(is24Hour ? (byte) 1 : (byte) 0);
-        mRemote.transact(UPDATE_TIME_PREFS_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    @Override
-    public void scheduleCancelVisibleBehind(IBinder token) throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeStrongBinder(token);
-        mRemote.transact(CANCEL_VISIBLE_BEHIND_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    @Override
-    public void scheduleBackgroundVisibleBehindChanged(IBinder token, boolean enabled)
-            throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeStrongBinder(token);
-        data.writeInt(enabled ? 1 : 0);
-        mRemote.transact(BACKGROUND_VISIBLE_BEHIND_CHANGED_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    @Override
-    public void scheduleEnterAnimationComplete(IBinder token) throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeStrongBinder(token);
-        mRemote.transact(ENTER_ANIMATION_COMPLETE_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    @Override
-    public void notifyCleartextNetwork(byte[] firstPacket) throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeByteArray(firstPacket);
-        mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    @Override
-    public void startBinderTracking() throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        mRemote.transact(START_BINDER_TRACKING_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    @Override
-    public void stopBinderTrackingAndDump(FileDescriptor fd) throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeFileDescriptor(fd);
-        mRemote.transact(STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    @Override
-    public final void scheduleMultiWindowModeChanged(
-            IBinder token, boolean isInMultiWindowMode) throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeStrongBinder(token);
-        data.writeInt(isInMultiWindowMode ? 1 : 0);
-        mRemote.transact(SCHEDULE_MULTI_WINDOW_CHANGED_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    @Override
-    public final void schedulePictureInPictureModeChanged(IBinder token, boolean isInPipMode)
-            throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        data.writeStrongBinder(token);
-        data.writeInt(isInPipMode ? 1 : 0);
-        mRemote.transact(SCHEDULE_PICTURE_IN_PICTURE_CHANGED_TRANSACTION, data, null,
-                IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-
-    @Override
-    public void handleTrustStorageUpdate() throws RemoteException {
-        Parcel data = Parcel.obtain();
-        data.writeInterfaceToken(IApplicationThread.descriptor);
-        mRemote.transact(HANDLE_TRUST_STORAGE_UPDATE_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
-        data.recycle();
-    }
-}
diff --git a/core/java/android/app/IApplicationThread.aidl b/core/java/android/app/IApplicationThread.aidl
new file mode 100644
index 0000000..2dd3b1a
--- /dev/null
+++ b/core/java/android/app/IApplicationThread.aidl
@@ -0,0 +1,162 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.app;
+
+import android.app.IInstrumentationWatcher;
+import android.app.IUiAutomationConnection;
+import android.app.ProfilerInfo;
+import android.app.ResultInfo;
+import android.content.ComponentName;
+import android.content.IIntentReceiver;
+import android.content.Intent;
+import android.content.pm.ActivityInfo;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.ProviderInfo;
+import android.content.pm.ServiceInfo;
+import android.content.res.CompatibilityInfo;
+import android.content.res.Configuration;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.Debug;
+import android.os.IBinder;
+import android.os.IInterface;
+import android.os.ParcelFileDescriptor;
+import android.os.PersistableBundle;
+
+import com.android.internal.app.IVoiceInteractor;
+import com.android.internal.content.ReferrerIntent;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * System private API for communicating with the application.  This is given to
+ * the activity manager by an application  when it starts up, for the activity
+ * manager to tell the application about things it needs to do.
+ *
+ * {@hide}
+ */
+oneway interface IApplicationThread {
+    /**
+     * Don't change the existing transaction Ids as they could be used in the native code.
+     * When adding a new method, assign the next available transaction id.
+     */
+    void schedulePauseActivity(IBinder token, boolean finished, boolean userLeaving,
+            int configChanges, boolean dontReport) = 1;
+    void scheduleStopActivity(IBinder token, boolean showWindow,
+            int configChanges) = 3;
+    void scheduleWindowVisibility(IBinder token, boolean showWindow) = 4;
+    void scheduleResumeActivity(IBinder token, int procState, boolean isForward,
+            in Bundle resumeArgs) = 5;
+    void scheduleSendResult(IBinder token, in List<ResultInfo> results) = 6;
+    void scheduleLaunchActivity(in Intent intent, IBinder token, int ident,
+            in ActivityInfo info, in Configuration curConfig, in Configuration overrideConfig,
+            in CompatibilityInfo compatInfo, in String referrer, IVoiceInteractor voiceInteractor,
+            int procState, in Bundle state, in PersistableBundle persistentState,
+            in List<ResultInfo> pendingResults, in List<ReferrerIntent> pendingNewIntents,
+            boolean notResumed, boolean isForward, in ProfilerInfo profilerInfo) = 7;
+    void scheduleNewIntent(
+            in List<ReferrerIntent> intent, IBinder token, boolean andPause) = 8;
+    void scheduleDestroyActivity(IBinder token, boolean finished,
+            int configChanges) = 9;
+    void scheduleReceiver(in Intent intent, in ActivityInfo info,
+            in CompatibilityInfo compatInfo,
+            int resultCode, in String data, in Bundle extras, boolean sync,
+            int sendingUser, int processState) = 10;
+    void scheduleCreateService(IBinder token, in ServiceInfo info,
+            in CompatibilityInfo compatInfo, int processState) = 11;
+    void scheduleStopService(IBinder token) = 12;
+    void bindApplication(in String packageName, in ApplicationInfo info,
+            in List<ProviderInfo> providers, in ComponentName testName,
+            in ProfilerInfo profilerInfo, in Bundle testArguments,
+            IInstrumentationWatcher testWatcher, IUiAutomationConnection uiAutomationConnection,
+            int debugMode, boolean enableBinderTracking, boolean trackAllocation,
+            boolean restrictedBackupMode, boolean persistent, in Configuration config,
+            in CompatibilityInfo compatInfo, in Map services,
+            in Bundle coreSettings, in String buildSerial) = 13;
+    void scheduleExit() = 14;
+    void scheduleConfigurationChanged(in Configuration config) = 16;
+    void scheduleServiceArgs(IBinder token, boolean taskRemoved, int startId,
+            int flags, in Intent args) = 17;
+    void updateTimeZone() = 18;
+    void processInBackground() = 19;
+    void scheduleBindService(IBinder token,
+            in Intent intent, boolean rebind, int processState) = 20;
+    void scheduleUnbindService(IBinder token,
+            in Intent intent) = 21;
+    void dumpService(in ParcelFileDescriptor fd, IBinder servicetoken,
+            in String[] args) = 22;
+    void scheduleRegisteredReceiver(IIntentReceiver receiver, in Intent intent,
+            int resultCode, in String data, in Bundle extras, boolean ordered,
+            boolean sticky, int sendingUser, int processState) = 23;
+    void scheduleLowMemory() = 24;
+    void scheduleActivityConfigurationChanged(IBinder token, in Configuration overrideConfig,
+            boolean reportToActivity) = 25;
+    void scheduleRelaunchActivity(IBinder token, in List<ResultInfo> pendingResults,
+            in List<ReferrerIntent> pendingNewIntents, int configChanges, boolean notResumed,
+            in Configuration config, in Configuration overrideConfig, boolean preserveWindow) = 26;
+    void scheduleSleeping(IBinder token, boolean sleeping) = 27;
+    void profilerControl(boolean start, in ProfilerInfo profilerInfo, int profileType) = 28;
+    void setSchedulingGroup(int group) = 29;
+    void scheduleCreateBackupAgent(in ApplicationInfo app, in CompatibilityInfo compatInfo,
+            int backupMode) = 30;
+    void scheduleDestroyBackupAgent(in ApplicationInfo app,
+            in CompatibilityInfo compatInfo) = 31;
+    void scheduleOnNewActivityOptions(IBinder token, in Bundle options) = 32;
+    void scheduleSuicide() = 33;
+    void dispatchPackageBroadcast(int cmd, in String[] packages) = 34;
+    void scheduleCrash(in String msg) = 35;
+    void dumpHeap(boolean managed, in String path, in ParcelFileDescriptor fd) = 36;
+    void dumpActivity(in ParcelFileDescriptor fd, IBinder servicetoken, in String prefix,
+            in String[] args) = 37;
+    void clearDnsCache() = 38;
+    void setHttpProxy(in String proxy, in String port, in String exclList,
+            in Uri pacFileUrl) = 39;
+    void setCoreSettings(in Bundle coreSettings) = 40;
+    void updatePackageCompatibilityInfo(in String pkg, in CompatibilityInfo info) = 41;
+    void scheduleTrimMemory(int level) = 42;
+    void dumpMemInfo(in ParcelFileDescriptor fd, in Debug.MemoryInfo mem, boolean checkin,
+            boolean dumpInfo, boolean dumpDalvik, boolean dumpSummaryOnly, boolean dumpUnreachable,
+            in String[] args) = 43;
+    void dumpGfxInfo(in ParcelFileDescriptor fd, in String[] args) = 44;
+    void dumpProvider(in ParcelFileDescriptor fd, IBinder servicetoken,
+            in String[] args) = 45;
+    void dumpDbInfo(in ParcelFileDescriptor fd, in String[] args) = 46;
+    void unstableProviderDied(IBinder provider) = 47;
+    void requestAssistContextExtras(IBinder activityToken, IBinder requestToken,
+            int requestType, int sessionId) = 48;
+    void scheduleTranslucentConversionComplete(IBinder token, boolean timeout) = 49;
+    void setProcessState(int state) = 50;
+    void scheduleInstallProvider(in ProviderInfo provider) = 51;
+    void updateTimePrefs(boolean is24Hour) = 52;
+    void scheduleCancelVisibleBehind(IBinder token) = 53;
+    void scheduleBackgroundVisibleBehindChanged(IBinder token, boolean enabled) = 54;
+    void scheduleEnterAnimationComplete(IBinder token) = 55;
+    void notifyCleartextNetwork(in byte[] firstPacket) = 56;
+    void startBinderTracking() = 57;
+    void stopBinderTrackingAndDump(in ParcelFileDescriptor fd) = 58;
+    void scheduleMultiWindowModeChanged(IBinder token, boolean isInMultiWindowMode) = 59;
+    void schedulePictureInPictureModeChanged(IBinder token,
+            boolean isInPictureInPictureMode) = 60;
+    void scheduleLocalVoiceInteractionStarted(IBinder token,
+            IVoiceInteractor voiceInteractor) = 61;
+    void handleTrustStorageUpdate() = 62;
+    /**
+     * Don't change the existing transaction Ids as they could be used in the native code.
+     * When adding a new method, assign the next available transaction id.
+     */
+}
\ No newline at end of file
diff --git a/core/java/android/app/IApplicationThread.java b/core/java/android/app/IApplicationThread.java
deleted file mode 100644
index 4189dd9..0000000
--- a/core/java/android/app/IApplicationThread.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.app;
-
-import android.content.ComponentName;
-import android.content.Intent;
-import android.content.IIntentReceiver;
-import android.content.pm.ActivityInfo;
-import android.content.pm.ApplicationInfo;
-import android.content.pm.ProviderInfo;
-import android.content.pm.ServiceInfo;
-import android.content.res.CompatibilityInfo;
-import android.content.res.Configuration;
-import android.net.Uri;
-import android.os.Bundle;
-import android.os.Debug;
-import android.os.ParcelFileDescriptor;
-import android.os.PersistableBundle;
-import android.os.RemoteException;
-import android.os.IBinder;
-import android.os.IInterface;
-import com.android.internal.app.IVoiceInteractor;
-import com.android.internal.content.ReferrerIntent;
-
-import java.io.FileDescriptor;
-import java.util.List;
-import java.util.Map;
-
-/**
- * System private API for communicating with the application.  This is given to
- * the activity manager by an application  when it starts up, for the activity
- * manager to tell the application about things it needs to do.
- *
- * {@hide}
- */
-public interface IApplicationThread extends IInterface {
-    void schedulePauseActivity(IBinder token, boolean finished, boolean userLeaving,
-            int configChanges, boolean dontReport) throws RemoteException;
-    void scheduleStopActivity(IBinder token, boolean showWindow,
-            int configChanges) throws RemoteException;
-    void scheduleWindowVisibility(IBinder token, boolean showWindow) throws RemoteException;
-    void scheduleSleeping(IBinder token, boolean sleeping) throws RemoteException;
-    void scheduleResumeActivity(IBinder token, int procState, boolean isForward, Bundle resumeArgs)
-            throws RemoteException;
-    void scheduleSendResult(IBinder token, List<ResultInfo> results) throws RemoteException;
-    void scheduleLaunchActivity(Intent intent, IBinder token, int ident,
-            ActivityInfo info, Configuration curConfig, Configuration overrideConfig,
-            CompatibilityInfo compatInfo, String referrer, IVoiceInteractor voiceInteractor,
-            int procState, Bundle state, PersistableBundle persistentState,
-            List<ResultInfo> pendingResults, List<ReferrerIntent> pendingNewIntents,
-            boolean notResumed, boolean isForward, ProfilerInfo profilerInfo) throws RemoteException;
-    void scheduleRelaunchActivity(IBinder token, List<ResultInfo> pendingResults,
-            List<ReferrerIntent> pendingNewIntents, int configChanges, boolean notResumed,
-            Configuration config, Configuration overrideConfig, boolean preserveWindow)
-            throws RemoteException;
-    void scheduleNewIntent(
-            List<ReferrerIntent> intent, IBinder token, boolean andPause) throws RemoteException;
-    void scheduleDestroyActivity(IBinder token, boolean finished,
-            int configChanges) throws RemoteException;
-    void scheduleReceiver(Intent intent, ActivityInfo info, CompatibilityInfo compatInfo,
-            int resultCode, String data, Bundle extras, boolean sync,
-            int sendingUser, int processState) throws RemoteException;
-    static final int BACKUP_MODE_INCREMENTAL = 0;
-    static final int BACKUP_MODE_FULL = 1;
-    static final int BACKUP_MODE_RESTORE = 2;
-    static final int BACKUP_MODE_RESTORE_FULL = 3;
-    void scheduleCreateBackupAgent(ApplicationInfo app, CompatibilityInfo compatInfo,
-            int backupMode) throws RemoteException;
-    void scheduleDestroyBackupAgent(ApplicationInfo app, CompatibilityInfo compatInfo)
-            throws RemoteException;
-    void scheduleCreateService(IBinder token, ServiceInfo info,
-            CompatibilityInfo compatInfo, int processState) throws RemoteException;
-    void scheduleBindService(IBinder token,
-            Intent intent, boolean rebind, int processState) throws RemoteException;
-    void scheduleUnbindService(IBinder token,
-            Intent intent) throws RemoteException;
-    void scheduleServiceArgs(IBinder token, boolean taskRemoved, int startId,
-            int flags, Intent args) throws RemoteException;
-    void scheduleStopService(IBinder token) throws RemoteException;
-    static final int DEBUG_OFF = 0;
-    static final int DEBUG_ON = 1;
-    static final int DEBUG_WAIT = 2;
-    void bindApplication(String packageName, ApplicationInfo info, List<ProviderInfo> providers,
-            ComponentName testName, ProfilerInfo profilerInfo, Bundle testArguments,
-            IInstrumentationWatcher testWatcher, IUiAutomationConnection uiAutomationConnection,
-            int debugMode, boolean enableBinderTracking, boolean trackAllocation,
-            boolean restrictedBackupMode, boolean persistent, Configuration config,
-            CompatibilityInfo compatInfo, Map<String, IBinder> services, Bundle coreSettings,
-            String buildSerial) throws RemoteException;
-    void scheduleExit() throws RemoteException;
-    void scheduleSuicide() throws RemoteException;
-    void scheduleConfigurationChanged(Configuration config) throws RemoteException;
-    void updateTimeZone() throws RemoteException;
-    void clearDnsCache() throws RemoteException;
-    void setHttpProxy(String proxy, String port, String exclList,
-            Uri pacFileUrl) throws RemoteException;
-    void processInBackground() throws RemoteException;
-    void dumpService(FileDescriptor fd, IBinder servicetoken, String[] args)
-            throws RemoteException;
-    void dumpProvider(FileDescriptor fd, IBinder servicetoken, String[] args)
-            throws RemoteException;
-    void scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent,
-            int resultCode, String data, Bundle extras, boolean ordered,
-            boolean sticky, int sendingUser, int processState) throws RemoteException;
-    void scheduleLowMemory() throws RemoteException;
-    void scheduleActivityConfigurationChanged(IBinder token, Configuration overrideConfig,
-            boolean reportToActivity) throws RemoteException;
-    void profilerControl(boolean start, ProfilerInfo profilerInfo, int profileType)
-            throws RemoteException;
-    void dumpHeap(boolean managed, String path, ParcelFileDescriptor fd)
-            throws RemoteException;
-    void setSchedulingGroup(int group) throws RemoteException;
-    // the package has been removed, clean up internal references
-    static final int PACKAGE_REMOVED = 0;
-    static final int EXTERNAL_STORAGE_UNAVAILABLE = 1;
-    // the package is being modified in-place, don't kill it and retain references to it
-    static final int PACKAGE_REMOVED_DONT_KILL = 2;
-    // a previously removed package was replaced with a new version [eg. upgrade, split added, ...]
-    static final int PACKAGE_REPLACED = 3;
-    void dispatchPackageBroadcast(int cmd, String[] packages) throws RemoteException;
-    void scheduleCrash(String msg) throws RemoteException;
-    void dumpActivity(FileDescriptor fd, IBinder servicetoken, String prefix, String[] args)
-            throws RemoteException;
-    void setCoreSettings(Bundle coreSettings) throws RemoteException;
-    void updatePackageCompatibilityInfo(String pkg, CompatibilityInfo info) throws RemoteException;
-    void scheduleTrimMemory(int level) throws RemoteException;
-    void dumpMemInfo(FileDescriptor fd, Debug.MemoryInfo mem, boolean checkin, boolean dumpInfo,
-            boolean dumpDalvik, boolean dumpSummaryOnly, boolean dumpUnreachable,
-            String[] args) throws RemoteException;
-    void dumpGfxInfo(FileDescriptor fd, String[] args) throws RemoteException;
-    void dumpDbInfo(FileDescriptor fd, String[] args) throws RemoteException;
-    void unstableProviderDied(IBinder provider) throws RemoteException;
-    void requestAssistContextExtras(IBinder activityToken, IBinder requestToken, int requestType,
-            int sessionId) throws RemoteException;
-    void scheduleTranslucentConversionComplete(IBinder token, boolean timeout)
-            throws RemoteException;
-    void scheduleOnNewActivityOptions(IBinder token, ActivityOptions options)
-            throws RemoteException;
-    void setProcessState(int state) throws RemoteException;
-    void scheduleInstallProvider(ProviderInfo provider) throws RemoteException;
-    void updateTimePrefs(boolean is24Hour) throws RemoteException;
-    void scheduleCancelVisibleBehind(IBinder token) throws RemoteException;
-    void scheduleBackgroundVisibleBehindChanged(IBinder token, boolean enabled) throws RemoteException;
-    void scheduleEnterAnimationComplete(IBinder token) throws RemoteException;
-    void notifyCleartextNetwork(byte[] firstPacket) throws RemoteException;
-    void startBinderTracking() throws RemoteException;
-    void stopBinderTrackingAndDump(FileDescriptor fd) throws RemoteException;
-    void scheduleMultiWindowModeChanged(IBinder token, boolean isInMultiWindowMode) throws RemoteException;
-    void schedulePictureInPictureModeChanged(IBinder token, boolean isInPictureInPictureMode) throws RemoteException;
-    void scheduleLocalVoiceInteractionStarted(IBinder token, IVoiceInteractor voiceInteractor) throws RemoteException;
-    void handleTrustStorageUpdate() throws RemoteException;
-
-    String descriptor = "android.app.IApplicationThread";
-
-    int SCHEDULE_PAUSE_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION;
-    int SCHEDULE_STOP_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+2;
-    int SCHEDULE_WINDOW_VISIBILITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+3;
-    int SCHEDULE_RESUME_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+4;
-    int SCHEDULE_SEND_RESULT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+5;
-    int SCHEDULE_LAUNCH_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+6;
-    int SCHEDULE_NEW_INTENT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+7;
-    int SCHEDULE_FINISH_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+8;
-    int SCHEDULE_RECEIVER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+9;
-    int SCHEDULE_CREATE_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+10;
-    int SCHEDULE_STOP_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+11;
-    int BIND_APPLICATION_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+12;
-    int SCHEDULE_EXIT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+13;
-
-    int SCHEDULE_CONFIGURATION_CHANGED_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+15;
-    int SCHEDULE_SERVICE_ARGS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+16;
-    int UPDATE_TIME_ZONE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+17;
-    int PROCESS_IN_BACKGROUND_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+18;
-    int SCHEDULE_BIND_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+19;
-    int SCHEDULE_UNBIND_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+20;
-    int DUMP_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+21;
-    int SCHEDULE_REGISTERED_RECEIVER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+22;
-    int SCHEDULE_LOW_MEMORY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+23;
-    int SCHEDULE_ACTIVITY_CONFIGURATION_CHANGED_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+24;
-    int SCHEDULE_RELAUNCH_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+25;
-    int SCHEDULE_SLEEPING_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+26;
-    int PROFILER_CONTROL_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+27;
-    int SET_SCHEDULING_GROUP_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+28;
-    int SCHEDULE_CREATE_BACKUP_AGENT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+29;
-    int SCHEDULE_DESTROY_BACKUP_AGENT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+30;
-    int SCHEDULE_ON_NEW_ACTIVITY_OPTIONS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+31;
-    int SCHEDULE_SUICIDE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+32;
-    int DISPATCH_PACKAGE_BROADCAST_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+33;
-    int SCHEDULE_CRASH_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+34;
-    int DUMP_HEAP_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+35;
-    int DUMP_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+36;
-    int CLEAR_DNS_CACHE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+37;
-    int SET_HTTP_PROXY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+38;
-    int SET_CORE_SETTINGS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+39;
-    int UPDATE_PACKAGE_COMPATIBILITY_INFO_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+40;
-    int SCHEDULE_TRIM_MEMORY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+41;
-    int DUMP_MEM_INFO_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+42;
-    int DUMP_GFX_INFO_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+43;
-    int DUMP_PROVIDER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+44;
-    int DUMP_DB_INFO_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+45;
-    int UNSTABLE_PROVIDER_DIED_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+46;
-    int REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+47;
-    int SCHEDULE_TRANSLUCENT_CONVERSION_COMPLETE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+48;
-    int SET_PROCESS_STATE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+49;
-    int SCHEDULE_INSTALL_PROVIDER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+50;
-    int UPDATE_TIME_PREFS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+51;
-    int CANCEL_VISIBLE_BEHIND_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+52;
-    int BACKGROUND_VISIBLE_BEHIND_CHANGED_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+53;
-    int ENTER_ANIMATION_COMPLETE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+54;
-    int NOTIFY_CLEARTEXT_NETWORK_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+55;
-    int START_BINDER_TRACKING_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+56;
-    int STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+57;
-    int SCHEDULE_MULTI_WINDOW_CHANGED_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+58;
-    int SCHEDULE_PICTURE_IN_PICTURE_CHANGED_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+59;
-    int SCHEDULE_LOCAL_VOICE_INTERACTION_STARTED_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+60;
-    int HANDLE_TRUST_STORAGE_UPDATE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+61;
-}
diff --git a/core/java/android/app/ProfilerInfo.aidl b/core/java/android/app/ProfilerInfo.aidl
new file mode 100644
index 0000000..dc744b9
--- /dev/null
+++ b/core/java/android/app/ProfilerInfo.aidl
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.app;
+
+/** @hide */
+parcelable ProfilerInfo;
\ No newline at end of file
diff --git a/core/java/android/app/ResultInfo.aidl b/core/java/android/app/ResultInfo.aidl
new file mode 100644
index 0000000..6c12e1c
--- /dev/null
+++ b/core/java/android/app/ResultInfo.aidl
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.app;
+
+/** @hide */
+parcelable ResultInfo;
\ No newline at end of file
diff --git a/core/java/android/os/Debug.aidl b/core/java/android/os/Debug.aidl
new file mode 100644
index 0000000..81a2c1f
--- /dev/null
+++ b/core/java/android/os/Debug.aidl
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.os;
+
+parcelable Debug.MemoryInfo;
\ No newline at end of file