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

Commit f56bef14 authored by John Spurlock's avatar John Spurlock
Browse files

Resolve car dock home activities properly.

Look up the actual user id (package manager does not understand
UserHandle.USER_CURRENT) and return metadata during resolution
for subsequent checking.

Bug: 9738229
Change-Id: Ib060bacc84473b27a1fb2e717651dc84f018d6f9
parent 9865ef1b
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import android.content.ServiceConnection;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.pm.UserInfo;
import android.content.res.CompatibilityInfo;
import android.content.res.Configuration;
import android.content.res.Resources;
@@ -4789,8 +4790,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        ActivityInfo ai = null;
        ResolveInfo info = mContext.getPackageManager().resolveActivityAsUser(
                intent,
                PackageManager.MATCH_DEFAULT_ONLY,
                UserHandle.USER_CURRENT);
                PackageManager.MATCH_DEFAULT_ONLY | PackageManager.GET_META_DATA,
                getCurrentUserId());
        if (info != null) {
            ai = info.activityInfo;
        }
@@ -4805,6 +4806,16 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        return null;
    }

    private int getCurrentUserId() {
        try {
            UserInfo user = ActivityManagerNative.getDefault().getCurrentUser();
            return user != null ? user.id : UserHandle.USER_NULL;
        } catch (RemoteException e) {
            // noop
        }
        return UserHandle.USER_NULL;
    }

    void startDockOrHome() {
        awakenDreams();