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

Commit 83dee9d0 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Rebind assistant services on user unlocked."

parents 30731ebe ef934fdd
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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) {
+2 −2
Original line number Diff line number Diff line
@@ -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");
+1 −1
Original line number Diff line number Diff line
@@ -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;
+6 −0
Original line number Diff line number Diff line
@@ -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);