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

Commit b29a6c9d authored by Youngjun Kwak's avatar Youngjun Kwak Committed by Automerger Merge Worker
Browse files

Merge "Add null check for resolveInfo and Automotive feature." into rvc-dev...

Merge "Add null check for resolveInfo and Automotive feature." into rvc-dev am: 97c9d1f8 am: f67ec51b am: b66b8c40 am: a81bb0fc

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12114119

Change-Id: Ieaea809cc8983b797c5797b7bb08d5020ae98f9e
parents 70eef402 a81bb0fc
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -228,6 +228,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab

    private final Context mContext;
    private final boolean mIsPrimaryUser;
    private final boolean mIsAutomotive;
    private final StatusBarStateController mStatusBarStateController;
    HashMap<Integer, SimData> mSimDatas = new HashMap<>();
    HashMap<Integer, ServiceState> mServiceStates = new HashMap<Integer, ServiceState>();
@@ -1771,6 +1772,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
            mFaceManager.addLockoutResetCallback(mFaceLockoutResetCallback);
        }

        mIsAutomotive = isAutomotive();

        ActivityManagerWrapper.getInstance().registerTaskStackListener(mTaskStackListener);
        mUserManager = context.getSystemService(UserManager.class);
        mIsPrimaryUser = mUserManager.isPrimaryUser();
@@ -2485,6 +2488,14 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
                .addCategory(Intent.CATEGORY_HOME);
        ResolveInfo resolveInfo = mContext.getPackageManager().resolveActivity(homeIntent,
                0 /* flags */);

        // TODO(b/160971249): Replace in the future by resolving activity as user.
        if (resolveInfo == null && mIsAutomotive) {
            Log.w(TAG, "resolveNeedsSlowUnlockTransition: returning false since activity "
                    + "could not be resolved.");
            return false;
        }

        return FALLBACK_HOME_COMPONENT.equals(resolveInfo.getComponentInfo().getComponentName());
    }

@@ -2555,6 +2566,10 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
        return false;
    }

    private boolean isAutomotive() {
        return mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE);
    }

    /**
     * Remove the given observer's callback.
     *
@@ -2991,5 +3006,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
                pw.println("    " + time + " " + model.toString());
            }
        }
        if (mIsAutomotive) {
            pw.println("  Running on Automotive build");
        }
    }
}