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

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

Merge "Unregister after replacement for network agent to avoid onLost"

parents fc7a8202 879fae04
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -50,6 +50,9 @@ public class TelephonyNetworkAgent extends NetworkAgent {
    private final String mLogTag;
    private final LocalLog mLocalLog = new LocalLog(128);

    /** Max unregister network agent delay. */
    private static final int NETWORK_AGENT_TEARDOWN_DELAY_MS = 5_000;

    /** The parent data network. */
    private final @NonNull DataNetwork mDataNetwork;

@@ -296,14 +299,15 @@ public class TelephonyNetworkAgent extends NetworkAgent {

    /**
     * Abandon the network agent. This is used for telephony to re-create the network agent when
     * immutable capabilities got changed, where telephony calls {@link NetworkAgent#unregister()}
     * and then create another network agent with new capabilities. Abandon this network agent
     * allowing it ignore the subsequent {@link #onNetworkUnwanted()} invocation caused by
     * {@link NetworkAgent#unregister()}.
     * immutable capabilities got changed, where telephony calls
     * {@link NetworkAgent#unregisterAfterReplacement} and then create another network agent with
     * new capabilities. Abandon this network agent allowing it ignore the subsequent
     * {@link #onNetworkUnwanted()} invocation caused by
     * {@link NetworkAgent#unregisterAfterReplacement}.
     */
    public void abandon() {
        mAbandoned = true;
        unregister();
        unregisterAfterReplacement(NETWORK_AGENT_TEARDOWN_DELAY_MS);
    }

    /**