Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 885fcee4 authored by Dianne Hackborn's avatar Dianne Hackborn Committed by Android Git Automerger
Browse files

am 4c0f6782: Merge "Fix issue #7215984: java.lang.RuntimeException: Unable to...

am 4c0f6782: Merge "Fix issue #7215984: java.lang.RuntimeException: Unable to create..." into jb-mr1-dev

* commit '4c0f6782':
  Fix issue #7215984: java.lang.RuntimeException: Unable to create...
parents e75104a4 4c0f6782
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -18797,7 +18797,7 @@ package android.provider {
    method public static int getInt(android.content.ContentResolver, java.lang.String) throws android.provider.Settings.SettingNotFoundException;
    method public static int getInt(android.content.ContentResolver, java.lang.String) throws android.provider.Settings.SettingNotFoundException;
    method public static long getLong(android.content.ContentResolver, java.lang.String, long);
    method public static long getLong(android.content.ContentResolver, java.lang.String, long);
    method public static long getLong(android.content.ContentResolver, java.lang.String) throws android.provider.Settings.SettingNotFoundException;
    method public static long getLong(android.content.ContentResolver, java.lang.String) throws android.provider.Settings.SettingNotFoundException;
    method public static synchronized java.lang.String getString(android.content.ContentResolver, java.lang.String);
    method public static java.lang.String getString(android.content.ContentResolver, java.lang.String);
    method public static android.net.Uri getUriFor(java.lang.String);
    method public static android.net.Uri getUriFor(java.lang.String);
    method public static boolean putFloat(android.content.ContentResolver, java.lang.String, float);
    method public static boolean putFloat(android.content.ContentResolver, java.lang.String, float);
    method public static boolean putInt(android.content.ContentResolver, java.lang.String, int);
    method public static boolean putInt(android.content.ContentResolver, java.lang.String, int);
@@ -18853,7 +18853,7 @@ package android.provider {
    method public static int getInt(android.content.ContentResolver, java.lang.String) throws android.provider.Settings.SettingNotFoundException;
    method public static int getInt(android.content.ContentResolver, java.lang.String) throws android.provider.Settings.SettingNotFoundException;
    method public static long getLong(android.content.ContentResolver, java.lang.String, long);
    method public static long getLong(android.content.ContentResolver, java.lang.String, long);
    method public static long getLong(android.content.ContentResolver, java.lang.String) throws android.provider.Settings.SettingNotFoundException;
    method public static long getLong(android.content.ContentResolver, java.lang.String) throws android.provider.Settings.SettingNotFoundException;
    method public static synchronized java.lang.String getString(android.content.ContentResolver, java.lang.String);
    method public static java.lang.String getString(android.content.ContentResolver, java.lang.String);
    method public static android.net.Uri getUriFor(java.lang.String);
    method public static android.net.Uri getUriFor(java.lang.String);
    method public static final boolean isLocationProviderEnabled(android.content.ContentResolver, java.lang.String);
    method public static final boolean isLocationProviderEnabled(android.content.ContentResolver, java.lang.String);
    method public static boolean putFloat(android.content.ContentResolver, java.lang.String, float);
    method public static boolean putFloat(android.content.ContentResolver, java.lang.String, float);
@@ -18936,7 +18936,7 @@ package android.provider {
    method public static long getLong(android.content.ContentResolver, java.lang.String, long);
    method public static long getLong(android.content.ContentResolver, java.lang.String, long);
    method public static long getLong(android.content.ContentResolver, java.lang.String) throws android.provider.Settings.SettingNotFoundException;
    method public static long getLong(android.content.ContentResolver, java.lang.String) throws android.provider.Settings.SettingNotFoundException;
    method public static deprecated boolean getShowGTalkServiceStatus(android.content.ContentResolver);
    method public static deprecated boolean getShowGTalkServiceStatus(android.content.ContentResolver);
    method public static synchronized java.lang.String getString(android.content.ContentResolver, java.lang.String);
    method public static java.lang.String getString(android.content.ContentResolver, java.lang.String);
    method public static android.net.Uri getUriFor(java.lang.String);
    method public static android.net.Uri getUriFor(java.lang.String);
    method public static boolean putConfiguration(android.content.ContentResolver, android.content.res.Configuration);
    method public static boolean putConfiguration(android.content.ContentResolver, android.content.res.Configuration);
    method public static boolean putFloat(android.content.ContentResolver, java.lang.String, float);
    method public static boolean putFloat(android.content.ContentResolver, java.lang.String, float);
+47 −77
Original line number Original line Diff line number Diff line
@@ -764,10 +764,6 @@ public final class Settings {
            return true;
            return true;
        }
        }


        public boolean putString(ContentResolver cr, String name, String value) {
            return putStringForUser(cr, name, value, UserHandle.myUserId());
        }

        public String getStringForUser(ContentResolver cr, String name, final int userHandle) {
        public String getStringForUser(ContentResolver cr, String name, final int userHandle) {
            final boolean isSelf = (userHandle == UserHandle.myUserId());
            final boolean isSelf = (userHandle == UserHandle.myUserId());
            if (isSelf) {
            if (isSelf) {
@@ -855,10 +851,6 @@ public final class Settings {
                if (c != null) c.close();
                if (c != null) c.close();
            }
            }
        }
        }

        public String getString(ContentResolver cr, String name) {
            return getStringForUser(cr, name, UserHandle.myUserId());
        }
    }
    }


    /**
    /**
@@ -869,8 +861,17 @@ public final class Settings {
    public static final class System extends NameValueTable {
    public static final class System extends NameValueTable {
        public static final String SYS_PROP_SETTING_VERSION = "sys.settings_system_version";
        public static final String SYS_PROP_SETTING_VERSION = "sys.settings_system_version";


        // Populated lazily, guarded by class object:
        /**
        private static NameValueCache sNameValueCache = null;
         * The content:// style URL for this table
         */
        public static final Uri CONTENT_URI =
            Uri.parse("content://" + AUTHORITY + "/system");

        private static final NameValueCache sNameValueCache = new NameValueCache(
                SYS_PROP_SETTING_VERSION,
                CONTENT_URI,
                CALL_METHOD_GET_SYSTEM,
                CALL_METHOD_PUT_SYSTEM);


        private static final HashSet<String> MOVED_TO_SECURE;
        private static final HashSet<String> MOVED_TO_SECURE;
        static {
        static {
@@ -937,28 +938,18 @@ public final class Settings {
            MOVED_TO_GLOBAL.add(Settings.Global.MODE_RINGER);
            MOVED_TO_GLOBAL.add(Settings.Global.MODE_RINGER);
        }
        }


        private static void lazyInitCache() {
            if (sNameValueCache == null) {
                sNameValueCache = new NameValueCache(
                        SYS_PROP_SETTING_VERSION + '_' + UserHandle.myUserId(),
                        CONTENT_URI,
                        CALL_METHOD_GET_SYSTEM,
                        CALL_METHOD_PUT_SYSTEM);
            }
        }

        /**
        /**
         * Look up a name in the database.
         * Look up a name in the database.
         * @param resolver to access the database with
         * @param resolver to access the database with
         * @param name to look up in the table
         * @param name to look up in the table
         * @return the corresponding value, or null if not present
         * @return the corresponding value, or null if not present
         */
         */
        public synchronized static String getString(ContentResolver resolver, String name) {
        public static String getString(ContentResolver resolver, String name) {
            return getStringForUser(resolver, name, UserHandle.myUserId());
            return getStringForUser(resolver, name, UserHandle.myUserId());
        }
        }


        /** @hide */
        /** @hide */
        public synchronized static String getStringForUser(ContentResolver resolver, String name,
        public static String getStringForUser(ContentResolver resolver, String name,
                int userHandle) {
                int userHandle) {
            if (MOVED_TO_SECURE.contains(name)) {
            if (MOVED_TO_SECURE.contains(name)) {
                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
@@ -970,7 +961,6 @@ public final class Settings {
                        + " to android.provider.Settings.Global, returning read-only value.");
                        + " to android.provider.Settings.Global, returning read-only value.");
                return Global.getStringForUser(resolver, name, userHandle);
                return Global.getStringForUser(resolver, name, userHandle);
            }
            }
            lazyInitCache();
            return sNameValueCache.getStringForUser(resolver, name, userHandle);
            return sNameValueCache.getStringForUser(resolver, name, userHandle);
        }
        }


@@ -998,7 +988,6 @@ public final class Settings {
                        + " to android.provider.Settings.Global, value is unchanged.");
                        + " to android.provider.Settings.Global, value is unchanged.");
                return false;
                return false;
            }
            }
            lazyInitCache();
            return sNameValueCache.putStringForUser(resolver, name, value, userHandle);
            return sNameValueCache.putStringForUser(resolver, name, value, userHandle);
        }
        }


@@ -1367,12 +1356,6 @@ public final class Settings {
            putIntForUser(cr, SHOW_GTALK_SERVICE_STATUS, flag ? 1 : 0, userHandle);
            putIntForUser(cr, SHOW_GTALK_SERVICE_STATUS, flag ? 1 : 0, userHandle);
        }
        }


        /**
         * The content:// style URL for this table
         */
        public static final Uri CONTENT_URI =
            Uri.parse("content://" + AUTHORITY + "/system");

        /**
        /**
         * @deprecated Use {@link android.provider.Settings.Global#STAY_ON_WHILE_PLUGGED_IN} instead
         * @deprecated Use {@link android.provider.Settings.Global#STAY_ON_WHILE_PLUGGED_IN} instead
         */
         */
@@ -2549,8 +2532,18 @@ public final class Settings {
    public static final class Secure extends NameValueTable {
    public static final class Secure extends NameValueTable {
        public static final String SYS_PROP_SETTING_VERSION = "sys.settings_secure_version";
        public static final String SYS_PROP_SETTING_VERSION = "sys.settings_secure_version";


        /**
         * The content:// style URL for this table
         */
        public static final Uri CONTENT_URI =
            Uri.parse("content://" + AUTHORITY + "/secure");

        // Populated lazily, guarded by class object:
        // Populated lazily, guarded by class object:
        private static NameValueCache sNameValueCache = null;
        private static final NameValueCache sNameValueCache = new NameValueCache(
                SYS_PROP_SETTING_VERSION,
                CONTENT_URI,
                CALL_METHOD_GET_SECURE,
                CALL_METHOD_PUT_SECURE);


        private static ILockSettings sLockSettings = null;
        private static ILockSettings sLockSettings = null;


@@ -2654,28 +2647,18 @@ public final class Settings {
            MOVED_TO_GLOBAL.add(Settings.Global.WTF_IS_FATAL);
            MOVED_TO_GLOBAL.add(Settings.Global.WTF_IS_FATAL);
        }
        }


        private static void lazyInitCache() {
            if (sNameValueCache == null) {
                sNameValueCache = new NameValueCache(
                        SYS_PROP_SETTING_VERSION + '_' + UserHandle.myUserId(),
                        CONTENT_URI,
                        CALL_METHOD_GET_SECURE,
                        CALL_METHOD_PUT_SECURE);
            }
        }

        /**
        /**
         * Look up a name in the database.
         * Look up a name in the database.
         * @param resolver to access the database with
         * @param resolver to access the database with
         * @param name to look up in the table
         * @param name to look up in the table
         * @return the corresponding value, or null if not present
         * @return the corresponding value, or null if not present
         */
         */
        public synchronized static String getString(ContentResolver resolver, String name) {
        public static String getString(ContentResolver resolver, String name) {
            return getStringForUser(resolver, name, UserHandle.myUserId());
            return getStringForUser(resolver, name, UserHandle.myUserId());
        }
        }


        /** @hide */
        /** @hide */
        public synchronized static String getStringForUser(ContentResolver resolver, String name,
        public static String getStringForUser(ContentResolver resolver, String name,
                int userHandle) {
                int userHandle) {
            if (MOVED_TO_GLOBAL.contains(name)) {
            if (MOVED_TO_GLOBAL.contains(name)) {
                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Secure"
                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Secure"
@@ -2683,21 +2666,23 @@ public final class Settings {
                return Global.getStringForUser(resolver, name, userHandle);
                return Global.getStringForUser(resolver, name, userHandle);
            }
            }


            if (MOVED_TO_LOCK_SETTINGS.contains(name)) {
                synchronized (Secure.class) {
                    if (sLockSettings == null) {
                    if (sLockSettings == null) {
                        sLockSettings = ILockSettings.Stub.asInterface(
                        sLockSettings = ILockSettings.Stub.asInterface(
                                (IBinder) ServiceManager.getService("lock_settings"));
                                (IBinder) ServiceManager.getService("lock_settings"));
                        sIsSystemProcess = Process.myUid() == Process.SYSTEM_UID;
                        sIsSystemProcess = Process.myUid() == Process.SYSTEM_UID;
                    }
                    }
            if (sLockSettings != null && !sIsSystemProcess
                }
                    && MOVED_TO_LOCK_SETTINGS.contains(name)) {
                if (sLockSettings != null && !sIsSystemProcess) {
                    try {
                    try {
                        return sLockSettings.getString(name, "0", userHandle);
                        return sLockSettings.getString(name, "0", userHandle);
                    } catch (RemoteException re) {
                    } catch (RemoteException re) {
                        // Fall through
                        // Fall through
                    }
                    }
                }
                }
            }


            lazyInitCache();
            return sNameValueCache.getStringForUser(resolver, name, userHandle);
            return sNameValueCache.getStringForUser(resolver, name, userHandle);
        }
        }


@@ -2720,7 +2705,6 @@ public final class Settings {
                        + " to android.provider.Settings.Global");
                        + " to android.provider.Settings.Global");
                return Global.putStringForUser(resolver, name, value, userHandle);
                return Global.putStringForUser(resolver, name, value, userHandle);
            }
            }
            lazyInitCache();
            return sNameValueCache.putStringForUser(resolver, name, value, userHandle);
            return sNameValueCache.putStringForUser(resolver, name, value, userHandle);
        }
        }


@@ -3000,12 +2984,6 @@ public final class Settings {
            return putStringForUser(cr, name, Float.toString(value), userHandle);
            return putStringForUser(cr, name, Float.toString(value), userHandle);
        }
        }


        /**
         * The content:// style URL for this table
         */
        public static final Uri CONTENT_URI =
            Uri.parse("content://" + AUTHORITY + "/secure");

        /**
        /**
         * @deprecated Use {@link android.provider.Settings.Global#DEVELOPMENT_SETTINGS_ENABLED}
         * @deprecated Use {@link android.provider.Settings.Global#DEVELOPMENT_SETTINGS_ENABLED}
         * instead
         * instead
@@ -5765,17 +5743,11 @@ public final class Settings {




        // Populated lazily, guarded by class object:
        // Populated lazily, guarded by class object:
        private static NameValueCache sNameValueCache = null;
        private static NameValueCache sNameValueCache = new NameValueCache(

        private static void lazyInitCache() {
            if (sNameValueCache == null) {
                sNameValueCache = new NameValueCache(
                    SYS_PROP_SETTING_VERSION,
                    SYS_PROP_SETTING_VERSION,
                    CONTENT_URI,
                    CONTENT_URI,
                    CALL_METHOD_GET_GLOBAL,
                    CALL_METHOD_GET_GLOBAL,
                    CALL_METHOD_PUT_GLOBAL);
                    CALL_METHOD_PUT_GLOBAL);
            }
        }


        /**
        /**
         * Look up a name in the database.
         * Look up a name in the database.
@@ -5783,14 +5755,13 @@ public final class Settings {
         * @param name to look up in the table
         * @param name to look up in the table
         * @return the corresponding value, or null if not present
         * @return the corresponding value, or null if not present
         */
         */
        public synchronized static String getString(ContentResolver resolver, String name) {
        public static String getString(ContentResolver resolver, String name) {
            return getStringForUser(resolver, name, UserHandle.myUserId());
            return getStringForUser(resolver, name, UserHandle.myUserId());
        }
        }


        /** @hide */
        /** @hide */
        public synchronized static String getStringForUser(ContentResolver resolver, String name,
        public static String getStringForUser(ContentResolver resolver, String name,
                int userHandle) {
                int userHandle) {
            lazyInitCache();
            return sNameValueCache.getStringForUser(resolver, name, userHandle);
            return sNameValueCache.getStringForUser(resolver, name, userHandle);
        }
        }


@@ -5809,7 +5780,6 @@ public final class Settings {
        /** @hide */
        /** @hide */
        public static boolean putStringForUser(ContentResolver resolver,
        public static boolean putStringForUser(ContentResolver resolver,
                String name, String value, int userHandle) {
                String name, String value, int userHandle) {
            lazyInitCache();
            if (LOCAL_LOGV) {
            if (LOCAL_LOGV) {
                Log.v(TAG, "Global.putString(name=" + name + ", value=" + value
                Log.v(TAG, "Global.putString(name=" + name + ", value=" + value
                        + " for " + userHandle);
                        + " for " + userHandle);
+2 −7
Original line number Original line Diff line number Diff line
@@ -315,10 +315,10 @@ public class SettingsProvider extends ContentProvider {
        String property = null, table = uri.getPathSegments().get(0);
        String property = null, table = uri.getPathSegments().get(0);
        final boolean isGlobal = table.equals(TABLE_GLOBAL);
        final boolean isGlobal = table.equals(TABLE_GLOBAL);
        if (table.equals(TABLE_SYSTEM)) {
        if (table.equals(TABLE_SYSTEM)) {
            property = Settings.System.SYS_PROP_SETTING_VERSION + '_' + userHandle;
            property = Settings.System.SYS_PROP_SETTING_VERSION;
            backedUpDataChanged = true;
            backedUpDataChanged = true;
        } else if (table.equals(TABLE_SECURE)) {
        } else if (table.equals(TABLE_SECURE)) {
            property = Settings.Secure.SYS_PROP_SETTING_VERSION + '_' + userHandle;
            property = Settings.Secure.SYS_PROP_SETTING_VERSION;
            backedUpDataChanged = true;
            backedUpDataChanged = true;
        } else if (isGlobal) {
        } else if (isGlobal) {
            property = Settings.Global.SYS_PROP_SETTING_VERSION;    // this one is global
            property = Settings.Global.SYS_PROP_SETTING_VERSION;    // this one is global
@@ -447,11 +447,6 @@ public class SettingsProvider extends ContentProvider {
            sSystemCaches.delete(userHandle);
            sSystemCaches.delete(userHandle);
            sSecureCaches.delete(userHandle);
            sSecureCaches.delete(userHandle);
            sKnownMutationsInFlight.delete(userHandle);
            sKnownMutationsInFlight.delete(userHandle);

            String property = Settings.System.SYS_PROP_SETTING_VERSION + '_' + userHandle;
            SystemProperties.set(property, "");
            property = Settings.Secure.SYS_PROP_SETTING_VERSION + '_' + userHandle;
            SystemProperties.set(property, "");
        }
        }
    }
    }


+1 −1
Original line number Original line Diff line number Diff line
@@ -706,7 +706,7 @@ public class ActiveServices {
        if (DEBUG_SERVICE) Slog.v(TAG, "retrieveServiceLocked: " + service
        if (DEBUG_SERVICE) Slog.v(TAG, "retrieveServiceLocked: " + service
                + " type=" + resolvedType + " callingUid=" + callingUid);
                + " type=" + resolvedType + " callingUid=" + callingUid);


        userId = mAm.handleIncomingUserLocked(callingPid, callingUid, userId,
        userId = mAm.handleIncomingUser(callingPid, callingUid, userId,
                false, true, "service", null);
                false, true, "service", null);


        if (service.getComponent() != null) {
        if (service.getComponent() != null) {
+23 −45
Original line number Original line Diff line number Diff line
@@ -2450,7 +2450,7 @@ public final class ActivityManagerService extends ActivityManagerNative
            String resultWho, int requestCode, int startFlags,
            String resultWho, int requestCode, int startFlags,
            String profileFile, ParcelFileDescriptor profileFd, Bundle options, int userId) {
            String profileFile, ParcelFileDescriptor profileFd, Bundle options, int userId) {
        enforceNotIsolatedCaller("startActivity");
        enforceNotIsolatedCaller("startActivity");
        userId = handleIncomingUserLocked(Binder.getCallingPid(), Binder.getCallingUid(), userId,
        userId = handleIncomingUser(Binder.getCallingPid(), Binder.getCallingUid(), userId,
                false, true, "startActivity", null);
                false, true, "startActivity", null);
        return mMainStack.startActivityMayWait(caller, -1, intent, resolvedType,
        return mMainStack.startActivityMayWait(caller, -1, intent, resolvedType,
                resultTo, resultWho, requestCode, startFlags, profileFile, profileFd,
                resultTo, resultWho, requestCode, startFlags, profileFile, profileFd,
@@ -2462,7 +2462,7 @@ public final class ActivityManagerService extends ActivityManagerNative
            String resultWho, int requestCode, int startFlags, String profileFile,
            String resultWho, int requestCode, int startFlags, String profileFile,
            ParcelFileDescriptor profileFd, Bundle options, int userId) {
            ParcelFileDescriptor profileFd, Bundle options, int userId) {
        enforceNotIsolatedCaller("startActivityAndWait");
        enforceNotIsolatedCaller("startActivityAndWait");
        userId = handleIncomingUserLocked(Binder.getCallingPid(), Binder.getCallingUid(), userId,
        userId = handleIncomingUser(Binder.getCallingPid(), Binder.getCallingUid(), userId,
                false, true, "startActivityAndWait", null);
                false, true, "startActivityAndWait", null);
        WaitResult res = new WaitResult();
        WaitResult res = new WaitResult();
        mMainStack.startActivityMayWait(caller, -1, intent, resolvedType,
        mMainStack.startActivityMayWait(caller, -1, intent, resolvedType,
@@ -2476,7 +2476,7 @@ public final class ActivityManagerService extends ActivityManagerNative
            String resultWho, int requestCode, int startFlags, Configuration config,
            String resultWho, int requestCode, int startFlags, Configuration config,
            Bundle options, int userId) {
            Bundle options, int userId) {
        enforceNotIsolatedCaller("startActivityWithConfig");
        enforceNotIsolatedCaller("startActivityWithConfig");
        userId = handleIncomingUserLocked(Binder.getCallingPid(), Binder.getCallingUid(), userId,
        userId = handleIncomingUser(Binder.getCallingPid(), Binder.getCallingUid(), userId,
                false, true, "startActivityWithConfig", null);
                false, true, "startActivityWithConfig", null);
        int ret = mMainStack.startActivityMayWait(caller, -1, intent, resolvedType,
        int ret = mMainStack.startActivityMayWait(caller, -1, intent, resolvedType,
                resultTo, resultWho, requestCode, startFlags,
                resultTo, resultWho, requestCode, startFlags,
@@ -2615,7 +2615,7 @@ public final class ActivityManagerService extends ActivityManagerNative
            Intent intent, String resolvedType, IBinder resultTo,
            Intent intent, String resolvedType, IBinder resultTo,
            String resultWho, int requestCode, int startFlags, Bundle options, int userId) {
            String resultWho, int requestCode, int startFlags, Bundle options, int userId) {
        userId = handleIncomingUserLocked(Binder.getCallingPid(), Binder.getCallingUid(), userId,
        userId = handleIncomingUser(Binder.getCallingPid(), Binder.getCallingUid(), userId,
                false, true, "startActivityInPackage", null);
                false, true, "startActivityInPackage", null);
        int ret = mMainStack.startActivityMayWait(null, uid, intent, resolvedType,
        int ret = mMainStack.startActivityMayWait(null, uid, intent, resolvedType,
@@ -2636,7 +2636,7 @@ public final class ActivityManagerService extends ActivityManagerNative
            Intent[] intents, String[] resolvedTypes, IBinder resultTo,
            Intent[] intents, String[] resolvedTypes, IBinder resultTo,
            Bundle options, int userId) {
            Bundle options, int userId) {
        userId = handleIncomingUserLocked(Binder.getCallingPid(), Binder.getCallingUid(), userId,
        userId = handleIncomingUser(Binder.getCallingPid(), Binder.getCallingUid(), userId,
                false, true, "startActivityInPackage", null);
                false, true, "startActivityInPackage", null);
        int ret = mMainStack.startActivities(null, uid, intents, resolvedTypes, resultTo,
        int ret = mMainStack.startActivities(null, uid, intents, resolvedTypes, resultTo,
                options, userId);
                options, userId);
@@ -3462,7 +3462,7 @@ public final class ActivityManagerService extends ActivityManagerNative
        enforceNotIsolatedCaller("clearApplicationUserData");
        enforceNotIsolatedCaller("clearApplicationUserData");
        int uid = Binder.getCallingUid();
        int uid = Binder.getCallingUid();
        int pid = Binder.getCallingPid();
        int pid = Binder.getCallingPid();
        userId = handleIncomingUserLocked(pid, uid,
        userId = handleIncomingUser(pid, uid,
                userId, false, true, "clearApplicationUserData", null);
                userId, false, true, "clearApplicationUserData", null);
        long callingId = Binder.clearCallingIdentity();
        long callingId = Binder.clearCallingIdentity();
        try {
        try {
@@ -3518,7 +3518,7 @@ public final class ActivityManagerService extends ActivityManagerNative
            throw new SecurityException(msg);
            throw new SecurityException(msg);
        }
        }
        userId = handleIncomingUserLocked(Binder.getCallingPid(), Binder.getCallingUid(),
        userId = handleIncomingUser(Binder.getCallingPid(), Binder.getCallingUid(),
                userId, true, true, "killBackgroundProcesses", null);
                userId, true, true, "killBackgroundProcesses", null);
        long callingId = Binder.clearCallingIdentity();
        long callingId = Binder.clearCallingIdentity();
        try {
        try {
@@ -3593,7 +3593,7 @@ public final class ActivityManagerService extends ActivityManagerNative
            Slog.w(TAG, msg);
            Slog.w(TAG, msg);
            throw new SecurityException(msg);
            throw new SecurityException(msg);
        }
        }
        userId = handleIncomingUserLocked(Binder.getCallingPid(), Binder.getCallingUid(),
        userId = handleIncomingUser(Binder.getCallingPid(), Binder.getCallingUid(),
                userId, true, true, "forceStopPackage", null);
                userId, true, true, "forceStopPackage", null);
        long callingId = Binder.clearCallingIdentity();
        long callingId = Binder.clearCallingIdentity();
        try {
        try {
@@ -4598,7 +4598,7 @@ public final class ActivityManagerService extends ActivityManagerNative
        synchronized(this) {
        synchronized(this) {
            int callingUid = Binder.getCallingUid();
            int callingUid = Binder.getCallingUid();
            int origUserId = userId;
            int origUserId = userId;
            userId = handleIncomingUserLocked(Binder.getCallingPid(), callingUid, userId,
            userId = handleIncomingUser(Binder.getCallingPid(), callingUid, userId,
                    type == ActivityManager.INTENT_SENDER_BROADCAST, true,
                    type == ActivityManager.INTENT_SENDER_BROADCAST, true,
                    "getIntentSender", null);
                    "getIntentSender", null);
            if (origUserId == UserHandle.USER_CURRENT) {
            if (origUserId == UserHandle.USER_CURRENT) {
@@ -5758,26 +5758,8 @@ public final class ActivityManagerService extends ActivityManagerNative
    public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
    public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
            int flags, int userId) {
            int flags, int userId) {
        final int callingUid = Binder.getCallingUid();
        userId = handleIncomingUser(Binder.getCallingPid(), Binder.getCallingUid(), userId,
        if (userId != UserHandle.getCallingUserId()) {
                false, true, "getRecentTasks", null);
            // Check if the caller is holding permissions for cross-user requests.
            if (checkComponentPermission(
                    android.Manifest.permission.INTERACT_ACROSS_USERS_FULL,
                    Binder.getCallingPid(), callingUid, -1, true)
                    != PackageManager.PERMISSION_GRANTED) {
                String msg = "Permission Denial: "
                        + "Request to get recent tasks for user " + userId
                        + " but is calling from user " + UserHandle.getUserId(callingUid)
                        + "; this requires "
                        + android.Manifest.permission.INTERACT_ACROSS_USERS_FULL;
                Slog.w(TAG, msg);
                throw new SecurityException(msg);
            } else {
                if (userId == UserHandle.USER_CURRENT) {
                    userId = mCurrentUserId;
                }
            }
        }
        synchronized (this) {
        synchronized (this) {
            enforceCallingPermission(android.Manifest.permission.GET_TASKS,
            enforceCallingPermission(android.Manifest.permission.GET_TASKS,
@@ -6681,7 +6663,7 @@ public final class ActivityManagerService extends ActivityManagerNative
            throw new SecurityException(msg);
            throw new SecurityException(msg);
        }
        }
        userId = handleIncomingUserLocked(Binder.getCallingPid(), Binder.getCallingUid(), userId,
        userId = handleIncomingUser(Binder.getCallingPid(), Binder.getCallingUid(), userId,
                false, true, "getContentProvider", null);
                false, true, "getContentProvider", null);
        return getContentProviderImpl(caller, name, null, stable, userId);
        return getContentProviderImpl(caller, name, null, stable, userId);
    }
    }
@@ -6690,7 +6672,7 @@ public final class ActivityManagerService extends ActivityManagerNative
            String name, int userId, IBinder token) {
            String name, int userId, IBinder token) {
        enforceCallingPermission(android.Manifest.permission.ACCESS_CONTENT_PROVIDERS_EXTERNALLY,
        enforceCallingPermission(android.Manifest.permission.ACCESS_CONTENT_PROVIDERS_EXTERNALLY,
            "Do not have permission in call getContentProviderExternal()");
            "Do not have permission in call getContentProviderExternal()");
        userId = handleIncomingUserLocked(Binder.getCallingPid(), Binder.getCallingUid(), userId,
        userId = handleIncomingUser(Binder.getCallingPid(), Binder.getCallingUid(), userId,
                false, true, "getContentProvider", null);
                false, true, "getContentProvider", null);
        return getContentProviderExternalUnchecked(name, token, userId);
        return getContentProviderExternalUnchecked(name, token, userId);
    }
    }
@@ -6955,7 +6937,7 @@ public final class ActivityManagerService extends ActivityManagerNative
     */
     */
    public String getProviderMimeType(Uri uri, int userId) {
    public String getProviderMimeType(Uri uri, int userId) {
        enforceNotIsolatedCaller("getProviderMimeType");
        enforceNotIsolatedCaller("getProviderMimeType");
        userId = handleIncomingUserLocked(Binder.getCallingPid(), Binder.getCallingUid(),
        userId = handleIncomingUser(Binder.getCallingPid(), Binder.getCallingUid(),
                userId, false, true, "getProviderMimeType", null);
                userId, false, true, "getProviderMimeType", null);
        final String name = uri.getAuthority();
        final String name = uri.getAuthority();
        final long ident = Binder.clearCallingIdentity();
        final long ident = Binder.clearCallingIdentity();
@@ -10928,14 +10910,6 @@ public final class ActivityManagerService extends ActivityManagerNative
    public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
    public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
            boolean requireFull, String name, String callerPackage) {
            boolean requireFull, String name, String callerPackage) {
        synchronized(this) {
            return handleIncomingUserLocked(callingPid, callingUid, userId, allowAll,
                    requireFull, name, callerPackage);
        }        
    }
    int handleIncomingUserLocked(int callingPid, int callingUid, int userId, boolean allowAll,
            boolean requireFull, String name, String callerPackage) {
        final int callingUserId = UserHandle.getUserId(callingUid);
        final int callingUserId = UserHandle.getUserId(callingUid);
        if (callingUserId != userId) {
        if (callingUserId != userId) {
            if (callingUid != 0 && callingUid != Process.SYSTEM_UID) {
            if (callingUid != 0 && callingUid != Process.SYSTEM_UID) {
@@ -10976,6 +10950,10 @@ public final class ActivityManagerService extends ActivityManagerNative
            }
            }
            if (userId == UserHandle.USER_CURRENT
            if (userId == UserHandle.USER_CURRENT
                    || userId == UserHandle.USER_CURRENT_OR_SELF) {
                    || userId == UserHandle.USER_CURRENT_OR_SELF) {
                // Note that we may be accessing this outside of a lock...
                // shouldn't be a big deal, if this is being called outside
                // of a locked context there is intrinsically a race with
                // the value the caller will receive and someone else changing it.
                userId = mCurrentUserId;
                userId = mCurrentUserId;
            }
            }
            if (!allowAll && userId < 0) {
            if (!allowAll && userId < 0) {
@@ -11282,7 +11260,7 @@ public final class ActivityManagerService extends ActivityManagerNative
                callingPid = Binder.getCallingPid();
                callingPid = Binder.getCallingPid();
            }
            }
            userId = this.handleIncomingUserLocked(callingPid, callingUid, userId,
            userId = this.handleIncomingUser(callingPid, callingUid, userId,
                    true, true, "registerReceiver", callerPackage);
                    true, true, "registerReceiver", callerPackage);
            List allSticky = null;
            List allSticky = null;
@@ -11517,7 +11495,7 @@ public final class ActivityManagerService extends ActivityManagerNative
            Slog.w(TAG, "Broadcast " + intent + " not ordered but result callback requested!");
            Slog.w(TAG, "Broadcast " + intent + " not ordered but result callback requested!");
        }
        }
        userId = handleIncomingUserLocked(callingPid, callingUid, userId,
        userId = handleIncomingUser(callingPid, callingUid, userId,
                true, false, "broadcast", callerPackage);
                true, false, "broadcast", callerPackage);
        // Make sure that the user who is receiving this broadcast is started.
        // Make sure that the user who is receiving this broadcast is started.
@@ -11930,7 +11908,7 @@ public final class ActivityManagerService extends ActivityManagerNative
            throw new IllegalArgumentException("File descriptors passed in Intent");
            throw new IllegalArgumentException("File descriptors passed in Intent");
        }
        }
        userId = handleIncomingUserLocked(Binder.getCallingPid(),
        userId = handleIncomingUser(Binder.getCallingPid(),
                Binder.getCallingUid(), userId, true, false, "removeStickyBroadcast", null);
                Binder.getCallingUid(), userId, true, false, "removeStickyBroadcast", null);
        synchronized(this) {
        synchronized(this) {
@@ -12018,7 +11996,7 @@ public final class ActivityManagerService extends ActivityManagerNative
            String profileFile, int flags, Bundle arguments,
            String profileFile, int flags, Bundle arguments,
            IInstrumentationWatcher watcher, int userId) {
            IInstrumentationWatcher watcher, int userId) {
        enforceNotIsolatedCaller("startInstrumentation");
        enforceNotIsolatedCaller("startInstrumentation");
        userId = handleIncomingUserLocked(Binder.getCallingPid(), Binder.getCallingUid(),
        userId = handleIncomingUser(Binder.getCallingPid(), Binder.getCallingUid(),
                userId, false, true, "startInstrumentation", null);
                userId, false, true, "startInstrumentation", null);
        // Refuse possible leaked file descriptors
        // Refuse possible leaked file descriptors
        if (arguments != null && arguments.hasFileDescriptors()) {
        if (arguments != null && arguments.hasFileDescriptors()) {
@@ -13864,7 +13842,7 @@ public final class ActivityManagerService extends ActivityManagerNative
    }
    }
    private ProcessRecord findProcessLocked(String process, int userId, String callName) {
    private ProcessRecord findProcessLocked(String process, int userId, String callName) {
        userId = handleIncomingUserLocked(Binder.getCallingPid(), Binder.getCallingUid(),
        userId = handleIncomingUser(Binder.getCallingPid(), Binder.getCallingUid(),
                userId, true, true, callName, null);
                userId, true, true, callName, null);
        ProcessRecord proc = null;
        ProcessRecord proc = null;
        try {
        try {