Rebind assistant services on user unlocked.
Change-Id: I25daeaffee282df3b2e3819a29db6c3117b163f5 Fixes: 72453895 Test: manual
This commit is contained in:
@@ -94,7 +94,7 @@ public class Assistant extends NotificationAssistantService {
|
||||
infile = mFile.openRead();
|
||||
readXml(infile);
|
||||
} catch (FileNotFoundException e) {
|
||||
// No data yet
|
||||
Log.d(TAG, "File doesn't exist or isn't readable yet");
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, "Unable to read channel impressions", e);
|
||||
} catch (NumberFormatException | XmlPullParserException e) {
|
||||
|
||||
@@ -325,7 +325,8 @@ public class AssistantTest extends ServiceTestCase<Assistant> {
|
||||
int dismiss2 = 777;
|
||||
String key2 = mAssistant.getKey("pkg2", 2, "channel2");
|
||||
|
||||
String xml = "<assistant version=\"1\">\n"
|
||||
String xml = "<?xml version='1.0' encoding='utf-8' standalone='yes' ?>"
|
||||
+ "<assistant version=\"1\">\n"
|
||||
+ "<impression-set key=\"" + key1 + "\" "
|
||||
+ "dismisses=\"" + dismiss1 + "\" views=\"" + views1
|
||||
+ "\" streak=\"" + streak1 + "\"/>\n"
|
||||
@@ -377,7 +378,6 @@ public class AssistantTest extends ServiceTestCase<Assistant> {
|
||||
mAssistant.insertImpressions(key2, ci2);
|
||||
mAssistant.insertImpressions(key3, ci3);
|
||||
|
||||
|
||||
XmlSerializer serializer = new FastXmlSerializer();
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
serializer.setOutput(new BufferedOutputStream(baos), "utf-8");
|
||||
|
||||
@@ -771,7 +771,7 @@ abstract public class ManagedServices {
|
||||
* Called whenever packages change, the user switches, or the secure setting
|
||||
* is altered. (For example in response to USER_SWITCHED in our broadcast receiver)
|
||||
*/
|
||||
private void rebindServices(boolean forceRebind) {
|
||||
protected void rebindServices(boolean forceRebind) {
|
||||
if (DEBUG) Slog.d(TAG, "rebindServices");
|
||||
final int[] userIds = mUserProfiles.getCurrentProfileIds();
|
||||
final int nUserIds = userIds.length;
|
||||
|
||||
@@ -5687,6 +5687,12 @@ public class NotificationManagerService extends SystemService {
|
||||
mListeners.unregisterService(removed.service, removed.userid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUserUnlocked(int user) {
|
||||
if (DEBUG) Slog.d(TAG, "onUserUnlocked u=" + user);
|
||||
rebindServices(true);
|
||||
}
|
||||
|
||||
public void onNotificationEnqueued(final NotificationRecord r) {
|
||||
final StatusBarNotification sbn = r.sbn;
|
||||
TrimCache trimCache = new TrimCache(sbn);
|
||||
|
||||
Reference in New Issue
Block a user