Move keyguard enabled to Component Override

When using RROs, android:enabled="@bool/form_factor_flag" won't work any
more. So we need to use a component override flag per b/135048762.

Test: Flash an adt3 with RRO enabled. see that systemui is coming up.
Bug: 173138807
Change-Id: If9a99f850ebb34755b4146b786c189f9fb590c3d
This commit is contained in:
Robin Lee
2020-11-19 22:34:37 +01:00
parent b2788d4475
commit 6335ad6565
4 changed files with 14 additions and 9 deletions

View File

@@ -623,8 +623,7 @@
<service <service
android:name=".keyguard.KeyguardService" android:name=".keyguard.KeyguardService"
android:exported="true" android:exported="true" />
android:enabled="@bool/config_enableKeyguardService" />
<activity android:name=".keyguard.WorkLockActivity" <activity android:name=".keyguard.WorkLockActivity"
android:label="@string/accessibility_desc_work_lock" android:label="@string/accessibility_desc_work_lock"

View File

@@ -44,9 +44,6 @@
<item>com.android.systemui.wmshell.WMShell</item> <item>com.android.systemui.wmshell.WMShell</item>
</string-array> </string-array>
<!-- Disable KeyguardService -->
<bool name="config_enableKeyguardService">false</bool>
<!-- Svelte specific logic, see RecentsConfiguration.SVELTE_* constants. --> <!-- Svelte specific logic, see RecentsConfiguration.SVELTE_* constants. -->
<integer name="recents_svelte_level">3</integer> <integer name="recents_svelte_level">3</integer>

View File

@@ -161,9 +161,6 @@
<!-- The number of milliseconds to extend ambient pulse by when prompted (e.g. on touch) --> <!-- The number of milliseconds to extend ambient pulse by when prompted (e.g. on touch) -->
<integer name="ambient_notification_extension_time">10000</integer> <integer name="ambient_notification_extension_time">10000</integer>
<!-- Whether to enable KeyguardService or not -->
<bool name="config_enableKeyguardService">true</bool>
<!-- The maximum count of notifications on Keyguard. The rest will be collapsed in an overflow <!-- The maximum count of notifications on Keyguard. The rest will be collapsed in an overflow
card. --> card. -->
<integer name="keyguard_max_notification_count">3</integer> <integer name="keyguard_max_notification_count">3</integer>

View File

@@ -34,10 +34,12 @@ import android.app.PendingIntent;
import android.app.StatusBarManager; import android.app.StatusBarManager;
import android.app.trust.TrustManager; import android.app.trust.TrustManager;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.ContentResolver; import android.content.ContentResolver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.UserInfo; import android.content.pm.UserInfo;
import android.hardware.biometrics.BiometricSourceType; import android.hardware.biometrics.BiometricSourceType;
import android.media.AudioAttributes; import android.media.AudioAttributes;
@@ -88,6 +90,7 @@ import com.android.systemui.SystemUI;
import com.android.systemui.broadcast.BroadcastDispatcher; import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.dagger.qualifiers.UiBackground; import com.android.systemui.dagger.qualifiers.UiBackground;
import com.android.systemui.dump.DumpManager; import com.android.systemui.dump.DumpManager;
import com.android.systemui.keyguard.KeyguardService;
import com.android.systemui.keyguard.dagger.KeyguardModule; import com.android.systemui.keyguard.dagger.KeyguardModule;
import com.android.systemui.navigationbar.NavigationModeController; import com.android.systemui.navigationbar.NavigationModeController;
import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.FalsingManager;
@@ -779,7 +782,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
// Assume keyguard is showing (unless it's disabled) until we know for sure, unless Keyguard // Assume keyguard is showing (unless it's disabled) until we know for sure, unless Keyguard
// is disabled. // is disabled.
if (mContext.getResources().getBoolean(R.bool.config_enableKeyguardService)) { if (isKeyguardServiceEnabled()) {
setShowingLocked(!shouldWaitForProvisioning() setShowingLocked(!shouldWaitForProvisioning()
&& !mLockPatternUtils.isLockScreenDisabled( && !mLockPatternUtils.isLockScreenDisabled(
KeyguardUpdateMonitor.getCurrentUser()), true /* forceCallbacks */); KeyguardUpdateMonitor.getCurrentUser()), true /* forceCallbacks */);
@@ -957,6 +960,15 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
mUpdateMonitor.dispatchFinishedGoingToSleep(why); mUpdateMonitor.dispatchFinishedGoingToSleep(why);
} }
private boolean isKeyguardServiceEnabled() {
try {
return mContext.getPackageManager().getServiceInfo(
new ComponentName(mContext, KeyguardService.class), 0).isEnabled();
} catch (NameNotFoundException e) {
return true;
}
}
private long getLockTimeout(int userId) { private long getLockTimeout(int userId) {
// if the screen turned off because of timeout or the user hit the power button // if the screen turned off because of timeout or the user hit the power button
// and we don't need to lock immediately, set an alarm // and we don't need to lock immediately, set an alarm