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

Commit 5a1f346e authored by Fyodor Kupolov's avatar Fyodor Kupolov Committed by Android (Google) Code Review
Browse files

Merge "Optimized onUnlockUser" into nyc-mr1-dev

parents d4ec5df7 7877b8ad
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -177,6 +177,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub

    static final int MSG_HARD_KEYBOARD_SWITCH_CHANGED = 4000;

    static final int MSG_SYSTEM_UNLOCK_USER = 5000;

    static final long TIME_TO_RECONNECT = 3 * 1000;

    static final int SECURE_SUGGESTION_SPANS_MAX_SIZE = 20;
@@ -800,14 +802,14 @@ public class InputMethodManagerService extends IInputMethodManager.Stub

        @Override
        public void onSwitchUser(@UserIdInt int userHandle) {
            // Called on the system server's main looper thread.
            // Called on ActivityManager thread.
            // TODO: Dispatch this to a worker thread as needed.
            mService.onSwitchUser(userHandle);
        }

        @Override
        public void onBootPhase(int phase) {
            // Called on the system server's main looper thread.
            // Called on ActivityManager thread.
            // TODO: Dispatch this to a worker thread as needed.
            if (phase == SystemService.PHASE_ACTIVITY_MANAGER_READY) {
                StatusBarManagerService statusBarService = (StatusBarManagerService) ServiceManager
@@ -817,10 +819,10 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
        }

        @Override
        public void onUnlockUser(@UserIdInt int userHandle) {
            // Called on the system server's main looper thread.
            // TODO: Dispatch this to a worker thread as needed.
            mService.onUnlockUser(userHandle);
        public void onUnlockUser(final @UserIdInt int userHandle) {
            // Called on ActivityManager thread.
            mService.mHandler.sendMessage(mService.mHandler.obtainMessage(MSG_SYSTEM_UNLOCK_USER,
                    userHandle));
        }
    }

@@ -2970,6 +2972,10 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
            case MSG_HARD_KEYBOARD_SWITCH_CHANGED:
                mHardKeyboardListener.handleHardKeyboardStatusChange(msg.arg1 == 1);
                return true;
            case MSG_SYSTEM_UNLOCK_USER:
                final int userId = msg.arg1;
                onUnlockUser(userId);
                return true;
        }
        return false;
    }
+4 −1
Original line number Diff line number Diff line
@@ -3216,7 +3216,10 @@ public class PackageManagerService extends IPackageManager.Stub {
        final PermissionsState permissionsState = ps.getPermissionsState();
        final int[] gids = permissionsState.computeGids(userId);
        // Compute GIDs only if requested
        final int[] gids = (flags & PackageManager.GET_GIDS) != 0
                ? permissionsState.computeGids(userId) : EMPTY_INT_ARRAY;
        // TODO b/29879962 Calculate granted permissions only if needed in generatePackageInfo
        final Set<String> permissions = permissionsState.getPermissions(userId);
        final PackageUserState state = ps.readUserState(userId);
+11 −2
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import android.content.pm.ResolveInfo;
import android.database.ContentObserver;
import android.os.Binder;
import android.os.Bundle;
import android.os.Handler;
import android.os.RemoteException;
import android.os.UserHandle;
import android.os.UserManager;
@@ -42,6 +43,7 @@ import android.util.SparseArray;

import com.android.internal.annotations.GuardedBy;
import com.android.internal.content.PackageMonitor;
import com.android.internal.os.BackgroundThread;
import com.android.internal.util.IndentingPrintWriter;
import com.android.server.LocalServices;
import com.android.server.SystemService;
@@ -57,6 +59,7 @@ import java.util.List;
 */
public class SearchManagerService extends ISearchManager.Stub {
    private static final String TAG = "SearchManagerService";
    final Handler mHandler;

    public static class Lifecycle extends SystemService {
        private SearchManagerService mService;
@@ -72,8 +75,13 @@ public class SearchManagerService extends ISearchManager.Stub {
        }

        @Override
        public void onUnlockUser(int userHandle) {
            mService.onUnlockUser(userHandle);
        public void onUnlockUser(final int userId) {
            mService.mHandler.post(new Runnable() {
                @Override
                public void run() {
                    mService.onUnlockUser(userId);
                }
            });
        }

        @Override
@@ -99,6 +107,7 @@ public class SearchManagerService extends ISearchManager.Stub {
        mContext = context;
        new MyPackageMonitor().register(context, null, UserHandle.ALL, true);
        new GlobalSearchProviderObserver(context.getContentResolver());
        mHandler = BackgroundThread.getHandler();
    }

    private Searchables getSearchables(int userId) {