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

Commit 58694316 authored by Ying Xu's avatar Ying Xu Committed by Automerger Merge Worker
Browse files

Merge "Add synchronization for refreshing InternetTile with cached states"...

Merge "Add synchronization for refreshing InternetTile with cached states" into udc-dev am: 721dc355

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22817363



Change-Id: I7cae6814fe00fb7e2a7a8b3a2ad949bd7cc9da17
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents ba216d74 721dc355
Loading
Loading
Loading
Loading
+26 −6
Original line number Diff line number Diff line
@@ -458,13 +458,28 @@ public class InternetTile extends QSTileImpl<SignalState> {
                getTileSpec(), mLastTileState, arg == null ? "null" : arg.toString());
        if (arg instanceof CellularCallbackInfo) {
            mLastTileState = LAST_STATE_CELLULAR;
            handleUpdateCellularState(state, arg);
            CellularCallbackInfo cb = (CellularCallbackInfo) arg;
            CellularCallbackInfo cellularInfo = new CellularCallbackInfo();
            synchronized (cb) {
                cb.copyTo(cellularInfo);
            }
            handleUpdateCellularState(state, cellularInfo);
        } else if (arg instanceof WifiCallbackInfo) {
            mLastTileState = LAST_STATE_WIFI;
            handleUpdateWifiState(state, arg);
            WifiCallbackInfo cb = (WifiCallbackInfo) arg;
            WifiCallbackInfo wifiInfo = new WifiCallbackInfo();
            synchronized (cb) {
                cb.copyTo(wifiInfo);
            }
            handleUpdateWifiState(state, wifiInfo);
        } else if (arg instanceof EthernetCallbackInfo) {
            mLastTileState = LAST_STATE_ETHERNET;
            handleUpdateEthernetState(state, arg);
            EthernetCallbackInfo cb = (EthernetCallbackInfo) arg;
            EthernetCallbackInfo ethernetInfo = new EthernetCallbackInfo();
            synchronized (cb) {
                cb.copyTo(ethernetInfo);
            }
            handleUpdateEthernetState(state, ethernetInfo);
        } else {
            // handleUpdateState will be triggered when user expands the QuickSetting panel with
            // arg = null, in this case the last updated CellularCallbackInfo or WifiCallbackInfo
@@ -476,11 +491,11 @@ public class InternetTile extends QSTileImpl<SignalState> {
                }
                handleUpdateCellularState(state, cellularInfo);
            } else if (mLastTileState == LAST_STATE_WIFI) {
                WifiCallbackInfo mifiInfo = new WifiCallbackInfo();
                WifiCallbackInfo wifiInfo = new WifiCallbackInfo();
                synchronized (mSignalCallback.mWifiInfo) {
                    mSignalCallback.mWifiInfo.copyTo(mifiInfo);
                    mSignalCallback.mWifiInfo.copyTo(wifiInfo);
                }
                handleUpdateWifiState(state, mifiInfo);
                handleUpdateWifiState(state, wifiInfo);
            } else if (mLastTileState == LAST_STATE_ETHERNET) {
                EthernetCallbackInfo ethernetInfo = new EthernetCallbackInfo();
                synchronized (mSignalCallback.mEthernetInfo) {
@@ -667,11 +682,16 @@ public class InternetTile extends QSTileImpl<SignalState> {
        }

        @Override
        @NonNull
        public Drawable getDrawable(Context context) {
            SignalDrawable d = new SignalDrawable(context);
            d.setLevel(getState());
            return d;
        }
        @Override
        public String toString() {
            return String.format("SignalIcon[mState=0x%08x]", mState);
        }
    }

    /**