summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author kwaky <kwaky@google.com> 2020-07-08 19:34:17 -0700
committer kwaky <kwaky@google.com> 2020-07-10 11:10:05 -0700
commit8ea210c48f6d80c2631bbaf2a1902124acdb3c29 (patch)
treeec58999ff5dd4654ebc7297ea301bb10c3e3bc9f
parente4c1cb514c9cc472ee5a519bf4f8416f1fa90d45 (diff)
Add null check for resolveInfo and Automotive feature.
AAOS uses multi-user model, and apps become queriable after user is unlocked. Thus we need to make sure that the querying happens at the right time with the right user with resolveActivityAsUser. In order not to affect the stability, we can use the null check + Automotive check for R. This null check + Automotive check can be removed when resolving Activity as User is implemented in S+. Bug: 158508455 Test: Manual Change-Id: I58e37f795136508ef7bb53c40214ed3c76f588bf
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
index 34c85877577b..d96662e33797 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
@@ -227,6 +227,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>();
@@ -1749,6 +1750,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();
@@ -2469,6 +2472,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());
}
@@ -2539,6 +2550,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.
*
@@ -2966,5 +2981,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
pw.println(" " + time + " " + model.toString());
}
}
+ if (mIsAutomotive) {
+ pw.println(" Running on Automotive build");
+ }
}
}