NoMan support for FBE.
Rebind to service components that should now available.
Bug: 26941542
Bug: 26940790
Change-Id: Id5290a75894f61cf55b3a2b82d08b1533bf099ca
diff --git a/services/core/java/com/android/server/notification/ManagedServices.java b/services/core/java/com/android/server/notification/ManagedServices.java
index f5da52e..29d52c1 100644
--- a/services/core/java/com/android/server/notification/ManagedServices.java
+++ b/services/core/java/com/android/server/notification/ManagedServices.java
@@ -250,6 +250,12 @@
rebindServices();
}
+ public void onUserUnlocked(int user) {
+ if (DEBUG) Slog.d(TAG, "onUserUnlocked u=" + user);
+ rebuildRestoredPackages();
+ rebindServices();
+ }
+
public ManagedServiceInfo getServiceFromTokenLocked(IInterface service) {
if (service == null) {
return null;
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index 078094c..bcb2c59 100644
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -816,6 +816,12 @@
} else if (action.equals(Intent.ACTION_USER_REMOVED)) {
final int user = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, UserHandle.USER_NULL);
mZenModeHelper.onUserRemoved(user);
+ } else if (action.equals(Intent.ACTION_USER_UNLOCKED)) {
+ final int user = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, UserHandle.USER_NULL);
+ mConditionProviders.onUserUnlocked(user);
+ mListeners.onUserUnlocked(user);
+ mAssistant.onUserUnlocked(user);
+ mZenModeHelper.onUserUnlocked(user);
}
}
};
@@ -994,6 +1000,7 @@
filter.addAction(Intent.ACTION_USER_SWITCHED);
filter.addAction(Intent.ACTION_USER_ADDED);
filter.addAction(Intent.ACTION_USER_REMOVED);
+ filter.addAction(Intent.ACTION_USER_UNLOCKED);
filter.addAction(Intent.ACTION_MANAGED_PROFILE_AVAILABILITY_CHANGED);
getContext().registerReceiver(mIntentReceiver, filter);
diff --git a/services/core/java/com/android/server/notification/ZenModeHelper.java b/services/core/java/com/android/server/notification/ZenModeHelper.java
index b7abce21..7518c6e 100644
--- a/services/core/java/com/android/server/notification/ZenModeHelper.java
+++ b/services/core/java/com/android/server/notification/ZenModeHelper.java
@@ -16,7 +16,6 @@
package com.android.server.notification;
-import static android.media.AudioAttributes.USAGE_ALARM;
import static android.media.AudioAttributes.USAGE_NOTIFICATION;
import static android.media.AudioAttributes.USAGE_NOTIFICATION_RINGTONE;
import static android.media.AudioAttributes.USAGE_UNKNOWN;
@@ -195,19 +194,7 @@
}
public void onUserSwitched(int user) {
- if (mUser == user || user < UserHandle.USER_SYSTEM) return;
- mUser = user;
- if (DEBUG) Log.d(TAG, "onUserSwitched u=" + user);
- ZenModeConfig config = mConfigs.get(user);
- if (config == null) {
- if (DEBUG) Log.d(TAG, "onUserSwitched: generating default config for user " + user);
- config = mDefaultConfig.copy();
- config.user = user;
- }
- synchronized (mConfig) {
- setConfigLocked(config, "onUserSwitched");
- }
- cleanUpZenRules();
+ loadConfigForUser(user, "onUserSwitched");
}
public void onUserRemoved(int user) {
@@ -216,6 +203,26 @@
mConfigs.remove(user);
}
+ public void onUserUnlocked(int user) {
+ loadConfigForUser(user, "onUserUnlocked");
+ }
+
+ private void loadConfigForUser(int user, String reason) {
+ if (mUser == user || user < UserHandle.USER_SYSTEM) return;
+ mUser = user;
+ if (DEBUG) Log.d(TAG, reason + " u=" + user);
+ ZenModeConfig config = mConfigs.get(user);
+ if (config == null) {
+ if (DEBUG) Log.d(TAG, reason + " generating default config for user " + user);
+ config = mDefaultConfig.copy();
+ config.user = user;
+ }
+ synchronized (mConfig) {
+ setConfigLocked(config, reason);
+ }
+ cleanUpZenRules();
+ }
+
public int getZenModeListenerInterruptionFilter() {
return NotificationManager.zenModeToInterruptionFilter(mZenMode);
}