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

Commit fcfd6a1f authored by Heemin Seog's avatar Heemin Seog Committed by Gerrit Code Review
Browse files

Merge "Use user context to support multiuser use case"

parents 50c00090 3e432fb4
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -491,8 +491,10 @@ public class AdapterService extends Service {
        }.execute();

        try {
            int systemUiUid = getApplicationContext().getPackageManager().getPackageUid(
                    "com.android.systemui", PackageManager.MATCH_SYSTEM_ONLY);
            int systemUiUid = getApplicationContext()
                    .createContextAsUser(UserHandle.SYSTEM, /* flags= */ 0)
                    .getPackageManager()
                    .getPackageUid("com.android.systemui", PackageManager.MATCH_SYSTEM_ONLY);

            Utils.setSystemUiUid(systemUiUid);
        } catch (PackageManager.NameNotFoundException e) {
+3 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import android.os.Looper;
import android.os.PowerManager;
import android.os.Process;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserManager;
import android.test.mock.MockContentResolver;
import android.util.Log;
@@ -130,6 +131,8 @@ public class AdapterServiceTest {
        when(mMockContext.getApplicationInfo()).thenReturn(mMockApplicationInfo);
        when(mMockContext.getContentResolver()).thenReturn(mMockContentResolver);
        when(mMockContext.getApplicationContext()).thenReturn(mMockContext);
        when(mMockContext.createContextAsUser(UserHandle.SYSTEM, /* flags= */ 0)).thenReturn(
                mMockContext);
        when(mMockContext.getResources()).thenReturn(mMockResources);
        when(mMockContext.getUserId()).thenReturn(Process.BLUETOOTH_UID);
        when(mMockContext.getPackageManager()).thenReturn(mMockPackageManager);