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

Commit e85133a8 authored by Bryce Lee's avatar Bryce Lee Committed by Automerger Merge Worker
Browse files

Merge "Notify TrustListeners when enabled trust agents change." into udc-dev am: 11ffcbfa

parents 6d445f76 11ffcbfa
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import java.util.List;
 * {@hide}
 */
oneway interface ITrustListener {
    void onEnabledTrustAgentsChanged(int userId);
    void onTrustChanged(boolean enabled, boolean newlyUnlocked, int userId, int flags,
        in List<String> trustGrantedMessages);
    void onTrustManagedChanged(boolean managed, int userId);
+17 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ public class TrustManager {
    private static final int MSG_TRUST_CHANGED = 1;
    private static final int MSG_TRUST_MANAGED_CHANGED = 2;
    private static final int MSG_TRUST_ERROR = 3;
    private static final int MSG_ENABLED_TRUST_AGENTS_CHANGED = 4;

    private static final String TAG = "TrustManager";
    private static final String DATA_FLAGS = "initiatedByUser";
@@ -186,6 +187,13 @@ public class TrustManager {
                    m.sendToTarget();
                }

                @Override
                public void onEnabledTrustAgentsChanged(int userId) {
                    final Message m = mHandler.obtainMessage(MSG_ENABLED_TRUST_AGENTS_CHANGED,
                            userId, 0, trustListener);
                    m.sendToTarget();
                }

                @Override
                public void onTrustManagedChanged(boolean managed, int userId) {
                    mHandler.obtainMessage(MSG_TRUST_MANAGED_CHANGED, (managed ? 1 : 0), userId,
@@ -283,6 +291,10 @@ public class TrustManager {
                case MSG_TRUST_ERROR:
                    final CharSequence message = msg.peekData().getCharSequence(DATA_MESSAGE);
                    ((TrustListener) msg.obj).onTrustError(message);
                    break;
                case MSG_ENABLED_TRUST_AGENTS_CHANGED:
                    ((TrustListener) msg.obj).onEnabledTrustAgentsChanged(msg.arg1);
                    break;
            }
        }
    };
@@ -316,5 +328,10 @@ public class TrustManager {
         * @param message A message that should be displayed on the UI.
         */
        void onTrustError(CharSequence message);

        /**
         * Reports that the enabled trust agents for the specified user has changed.
         */
        void onEnabledTrustAgentsChanged(int userId);
    }
}
+12 −0
Original line number Diff line number Diff line
@@ -587,6 +587,18 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
        dispatchErrorMessage(message);
    }

    @Override
    public void onEnabledTrustAgentsChanged(int userId) {
        Assert.isMainThread();

        for (int i = 0; i < mCallbacks.size(); i++) {
            KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
            if (cb != null) {
                cb.onEnabledTrustAgentsChanged(userId);
            }
        }
    }

    private void handleSimSubscriptionInfoChanged() {
        Assert.isMainThread();
        mLogger.v("onSubscriptionInfoChanged()");
+5 −0
Original line number Diff line number Diff line
@@ -322,4 +322,9 @@ public class KeyguardUpdateMonitorCallback {
     * Called when keyguard is going away or not going away.
     */
    public void onKeyguardGoingAway() { }

    /**
     * Called when the enabled trust agents associated with the specified user.
     */
    public void onEnabledTrustAgentsChanged(int userId) { }
}
+2 −0
Original line number Diff line number Diff line
@@ -80,6 +80,8 @@ constructor(
                        override fun onTrustError(message: CharSequence?) = Unit

                        override fun onTrustManagedChanged(enabled: Boolean, userId: Int) = Unit

                        override fun onEnabledTrustAgentsChanged(userId: Int) = Unit
                    }
                trustManager.registerTrustListener(callback)
                logger.trustListenerRegistered()
Loading