Merge "Add wakefullness calls on main thread" into sc-v2-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
8eb5097e76
@@ -261,8 +261,10 @@ public class CarrierTextManager {
|
|||||||
mCarrierTextCallback = callback;
|
mCarrierTextCallback = callback;
|
||||||
if (mNetworkSupported.get()) {
|
if (mNetworkSupported.get()) {
|
||||||
// Keyguard update monitor expects callbacks from main thread
|
// Keyguard update monitor expects callbacks from main thread
|
||||||
mMainExecutor.execute(() -> mKeyguardUpdateMonitor.registerCallback(mCallback));
|
mMainExecutor.execute(() -> {
|
||||||
mWakefulnessLifecycle.addObserver(mWakefulnessObserver);
|
mKeyguardUpdateMonitor.registerCallback(mCallback);
|
||||||
|
mWakefulnessLifecycle.addObserver(mWakefulnessObserver);
|
||||||
|
});
|
||||||
mTelephonyListenerManager.addActiveDataSubscriptionIdListener(mPhoneStateListener);
|
mTelephonyListenerManager.addActiveDataSubscriptionIdListener(mPhoneStateListener);
|
||||||
} else {
|
} else {
|
||||||
// Don't listen and clear out the text when the device isn't a phone.
|
// Don't listen and clear out the text when the device isn't a phone.
|
||||||
@@ -272,8 +274,10 @@ public class CarrierTextManager {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mCarrierTextCallback = null;
|
mCarrierTextCallback = null;
|
||||||
mMainExecutor.execute(() -> mKeyguardUpdateMonitor.removeCallback(mCallback));
|
mMainExecutor.execute(() -> {
|
||||||
mWakefulnessLifecycle.removeObserver(mWakefulnessObserver);
|
mKeyguardUpdateMonitor.removeCallback(mCallback);
|
||||||
|
mWakefulnessLifecycle.removeObserver(mWakefulnessObserver);
|
||||||
|
});
|
||||||
mTelephonyListenerManager.removeActiveDataSubscriptionIdListener(mPhoneStateListener);
|
mTelephonyListenerManager.removeActiveDataSubscriptionIdListener(mPhoneStateListener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user