Merge "Address small comments from http://ag/13957078" into sc-dev

This commit is contained in:
Dave Mankoff
2021-03-25 13:13:34 +00:00
committed by Android (Google) Code Review
4 changed files with 29 additions and 12 deletions

View File

@@ -160,11 +160,18 @@ public class CarrierTextManager {
*
* @param separator Separator between different parts of the text
*/
private CarrierTextManager(Context context, CharSequence separator, boolean showAirplaneMode,
boolean showMissingSim, @Nullable WifiManager wifiManager,
TelephonyManager telephonyManager, TelephonyListenerManager telephonyListenerManager,
WakefulnessLifecycle wakefulnessLifecycle, @Main Executor mainExecutor,
@Background Executor bgExecutor, KeyguardUpdateMonitor keyguardUpdateMonitor) {
private CarrierTextManager(
Context context,
CharSequence separator,
boolean showAirplaneMode,
boolean showMissingSim,
@Nullable WifiManager wifiManager,
TelephonyManager telephonyManager,
TelephonyListenerManager telephonyListenerManager,
WakefulnessLifecycle wakefulnessLifecycle,
@Main Executor mainExecutor,
@Background Executor bgExecutor,
KeyguardUpdateMonitor keyguardUpdateMonitor) {
mContext = context;
mIsEmergencyCallCapable = telephonyManager.isVoiceCapable();
@@ -633,12 +640,15 @@ public class CarrierTextManager {
private boolean mShowMissingSim;
@Inject
public Builder(Context context, @Main Resources resources,
public Builder(
Context context,
@Main Resources resources,
@Nullable WifiManager wifiManager,
TelephonyManager telephonyManager,
TelephonyListenerManager telephonyListenerManager,
WakefulnessLifecycle wakefulnessLifecycle,
@Main Executor mainExecutor, @Background Executor bgExecutor,
@Main Executor mainExecutor,
@Background Executor bgExecutor,
KeyguardUpdateMonitor keyguardUpdateMonitor) {
mContext = context;
mSeparator = resources.getString(
@@ -668,8 +678,8 @@ public class CarrierTextManager {
public CarrierTextManager build() {
return new CarrierTextManager(
mContext, mSeparator, mShowAirplaneMode, mShowMissingSim, mWifiManager,
mTelephonyManager, mTelephonyListenerManager,
mWakefulnessLifecycle, mMainExecutor, mBgExecutor, mKeyguardUpdateMonitor);
mTelephonyManager, mTelephonyListenerManager, mWakefulnessLifecycle,
mMainExecutor, mBgExecutor, mKeyguardUpdateMonitor);
}
}
/**

View File

@@ -28,6 +28,12 @@ import java.util.List;
import javax.inject.Inject;
/**
* Class for use by {@link TelephonyListenerManager} to centralize TelephonyManager Callbacks.
*
* There are more callback interfaces defined in {@link android.telephony.TelephonyCallback} that
* are not currently covered. Add them here if they ever become necessary.
*/
class TelephonyCallback extends android.telephony.TelephonyCallback
implements ActiveDataSubscriptionIdListener, CallStateListener, ServiceStateListener {

View File

@@ -47,7 +47,9 @@ public class TelephonyListenerManager {
private boolean mListening = false;
@Inject
public TelephonyListenerManager(TelephonyManager telephonyManager, @Main Executor executor,
public TelephonyListenerManager(
TelephonyManager telephonyManager,
@Main Executor executor,
TelephonyCallback telephonyCallback) {
mTelephonyManager = telephonyManager;
mExecutor = executor;

View File

@@ -27,7 +27,6 @@ import androidx.test.runner.AndroidJUnit4;
import com.android.systemui.SysuiTestCase;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -36,7 +35,7 @@ import org.junit.runner.RunWith;
public class TelephonyCallbackTest extends SysuiTestCase {
private TelephonyCallback mTelephonyCallback = new TelephonyCallback();
@Test
public void testAddListener_ActiveDataSubscriptionIdListener() {
assertThat(mTelephonyCallback.hasAnyListeners()).isFalse();