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

Commit 13daed9f authored by Erik Kline's avatar Erik Kline Committed by android-build-merger
Browse files

Add WaitForProvisioningCallback

am: 111d5565

* commit '111d5565':
  Add WaitForProvisioningCallback
parents 69ce6a0f 111d5565
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
@@ -109,6 +109,35 @@ public class IpManager extends StateMachine {
        public void onQuit() {}
    }

    public static class WaitForProvisioningCallback extends Callback {
        private LinkProperties mCallbackLinkProperties;

        public LinkProperties waitForProvisioning() {
            synchronized (this) {
                try {
                    wait();
                } catch (InterruptedException e) {}
                return mCallbackLinkProperties;
            }
        }

        @Override
        public void onProvisioningSuccess(LinkProperties newLp) {
            synchronized (this) {
                mCallbackLinkProperties = newLp;
                notify();
            }
        }

        @Override
        public void onProvisioningFailure(LinkProperties newLp) {
            synchronized (this) {
                mCallbackLinkProperties = null;
                notify();
            }
        }
    }

    /**
     * This class encapsulates parameters to be passed to
     * IpManager#startProvisioning(). A defensive copy is made by IpManager