diff options
9 files changed, 40 insertions, 6 deletions
diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_emergency_carrier_area.xml b/packages/SystemUI/res-keyguard/layout/keyguard_emergency_carrier_area.xml index 8bb78775e727..371670cba1ba 100644 --- a/packages/SystemUI/res-keyguard/layout/keyguard_emergency_carrier_area.xml +++ b/packages/SystemUI/res-keyguard/layout/keyguard_emergency_carrier_area.xml @@ -39,7 +39,8 @@ android:ellipsize="marquee" android:visibility="gone" android:gravity="center" - androidprv:allCaps="@bool/kg_use_all_caps" /> + androidprv:allCaps="@bool/kg_use_all_caps" + androidprv:debugLocation="Emergency" /> <com.android.keyguard.EmergencyButton android:id="@+id/emergency_call_button" diff --git a/packages/SystemUI/res/layout/keyguard_status_bar.xml b/packages/SystemUI/res/layout/keyguard_status_bar.xml index 8b8594032816..64c4effece1b 100644 --- a/packages/SystemUI/res/layout/keyguard_status_bar.xml +++ b/packages/SystemUI/res/layout/keyguard_status_bar.xml @@ -78,6 +78,7 @@ android:textColor="?attr/wallpaperTextColorSecondary" android:singleLine="true" systemui:showMissingSim="true" - systemui:showAirplaneMode="true" /> + systemui:showAirplaneMode="true" + systemui:debugLocation="Keyguard" /> </com.android.systemui.statusbar.phone.KeyguardStatusBarView> diff --git a/packages/SystemUI/res/values/attrs.xml b/packages/SystemUI/res/values/attrs.xml index 8d8fdf01c0fb..bd86e51ccf8f 100644 --- a/packages/SystemUI/res/values/attrs.xml +++ b/packages/SystemUI/res/values/attrs.xml @@ -146,6 +146,7 @@ <attr name="allCaps" format="boolean" /> <attr name="showMissingSim" format="boolean" /> <attr name="showAirplaneMode" format="boolean" /> + <attr name="debugLocation" format="string" /> </declare-styleable> <declare-styleable name="IlluminationDrawable"> diff --git a/packages/SystemUI/src/com/android/keyguard/CarrierText.java b/packages/SystemUI/src/com/android/keyguard/CarrierText.java index e4f6e131258e..87a9b0f17a1c 100644 --- a/packages/SystemUI/src/com/android/keyguard/CarrierText.java +++ b/packages/SystemUI/src/com/android/keyguard/CarrierText.java @@ -33,6 +33,8 @@ public class CarrierText extends TextView { private final boolean mShowAirplaneMode; + private final String mDebugLocation; + public CarrierText(Context context) { this(context, null); } @@ -46,6 +48,7 @@ public class CarrierText extends TextView { useAllCaps = a.getBoolean(R.styleable.CarrierText_allCaps, false); mShowAirplaneMode = a.getBoolean(R.styleable.CarrierText_showAirplaneMode, false); mShowMissingSim = a.getBoolean(R.styleable.CarrierText_showMissingSim, false); + mDebugLocation = a.getString(R.styleable.CarrierText_debugLocation); } finally { a.recycle(); } @@ -70,6 +73,10 @@ public class CarrierText extends TextView { return mShowMissingSim; } + public String getDebugLocation() { + return mDebugLocation; + } + private static class CarrierTextTransformationMethod extends SingleLineTransformationMethod { private final Locale mLocale; private final boolean mAllCaps; diff --git a/packages/SystemUI/src/com/android/keyguard/CarrierTextController.java b/packages/SystemUI/src/com/android/keyguard/CarrierTextController.java index 997c5275a2fa..33f9ecd03bca 100644 --- a/packages/SystemUI/src/com/android/keyguard/CarrierTextController.java +++ b/packages/SystemUI/src/com/android/keyguard/CarrierTextController.java @@ -53,6 +53,7 @@ public class CarrierTextController extends ViewController<CarrierText> { mCarrierTextManager = carrierTextManagerBuilder .setShowAirplaneMode(mView.getShowAirplaneMode()) .setShowMissingSim(mView.getShowMissingSim()) + .setDebugLocationString(mView.getDebugLocation()) .build(); mKeyguardUpdateMonitor = keyguardUpdateMonitor; } diff --git a/packages/SystemUI/src/com/android/keyguard/CarrierTextManager.java b/packages/SystemUI/src/com/android/keyguard/CarrierTextManager.java index 1f75e81c201f..a724514f6ec9 100644 --- a/packages/SystemUI/src/com/android/keyguard/CarrierTextManager.java +++ b/packages/SystemUI/src/com/android/keyguard/CarrierTextManager.java @@ -651,6 +651,7 @@ public class CarrierTextManager { private final CarrierTextManagerLogger mLogger; private boolean mShowAirplaneMode; private boolean mShowMissingSim; + private String mDebugLocation; @Inject public Builder( @@ -689,14 +690,25 @@ public class CarrierTextManager { return this; } + /** + * To help disambiguate logs, set a location to be used in the LogBuffer calls, e.g.: + * "keyguard" or "keyguard emergency status bar" + */ + public Builder setDebugLocationString(String debugLocationString) { + mDebugLocation = debugLocationString; + return this; + } + /** Create a CarrierTextManager. */ public CarrierTextManager build() { + mLogger.setLocation(mDebugLocation); return new CarrierTextManager( mContext, mSeparator, mShowAirplaneMode, mShowMissingSim, mWifiRepository, mTelephonyManager, mTelephonyListenerManager, mWakefulnessLifecycle, mMainExecutor, mBgExecutor, mKeyguardUpdateMonitor, mLogger); } } + /** * Data structure for passing information to CarrierTextController subscribers */ diff --git a/packages/SystemUI/src/com/android/keyguard/logging/CarrierTextManagerLogger.kt b/packages/SystemUI/src/com/android/keyguard/logging/CarrierTextManagerLogger.kt index 4001a4efb699..19787154bec4 100644 --- a/packages/SystemUI/src/com/android/keyguard/logging/CarrierTextManagerLogger.kt +++ b/packages/SystemUI/src/com/android/keyguard/logging/CarrierTextManagerLogger.kt @@ -18,16 +18,20 @@ package com.android.keyguard.logging import androidx.annotation.IntDef import com.android.keyguard.CarrierTextManager.CarrierTextCallbackInfo -import com.android.systemui.dagger.SysUISingleton import com.android.systemui.log.LogBuffer import com.android.systemui.log.LogLevel import com.android.systemui.log.dagger.CarrierTextManagerLog import javax.inject.Inject /** Logger adapter for [CarrierTextManager] to add detailed messages in a [LogBuffer] */ -@SysUISingleton class CarrierTextManagerLogger @Inject constructor(@CarrierTextManagerLog val buffer: LogBuffer) { /** + * To help disambiguate carrier text manager instances, set a location string here which will + * propagate to [logUpdate] and [logUpdateCarrierTextForReason] + */ + var location: String? = null + + /** * This method and the methods below trace the execution of CarrierTextManager.updateCarrierText */ fun logUpdate(numSubs: Int) { @@ -35,7 +39,7 @@ class CarrierTextManagerLogger @Inject constructor(@CarrierTextManagerLog val bu TAG, LogLevel.VERBOSE, { int1 = numSubs }, - { "updateCarrierText: numSubs=$int1" }, + { "updateCarrierText: location=${location ?: "(unknown)"} numSubs=$int1" }, ) } @@ -99,7 +103,10 @@ class CarrierTextManagerLogger @Inject constructor(@CarrierTextManagerLog val bu TAG, LogLevel.DEBUG, { int1 = reason }, - { "refreshing carrier info for reason: ${reason.reasonMessage()}" } + { + "refreshing carrier info for reason: ${reason.reasonMessage()}" + + " location=${location ?: "(unknown)"}" + } ) } diff --git a/packages/SystemUI/src/com/android/systemui/shade/carrier/ShadeCarrierGroupController.java b/packages/SystemUI/src/com/android/systemui/shade/carrier/ShadeCarrierGroupController.java index 0ebcfa2a1876..fc1e87ad3e45 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/carrier/ShadeCarrierGroupController.java +++ b/packages/SystemUI/src/com/android/systemui/shade/carrier/ShadeCarrierGroupController.java @@ -141,6 +141,7 @@ public class ShadeCarrierGroupController { mCarrierTextManager = carrierTextManagerBuilder .setShowAirplaneMode(false) .setShowMissingSim(false) + .setDebugLocationString("Shade") .build(); mCarrierConfigTracker = carrierConfigTracker; mSlotIndexResolver = slotIndexResolver; diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/carrier/ShadeCarrierGroupControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/shade/carrier/ShadeCarrierGroupControllerTest.java index 2ef3d60c7754..57ae621f01ef 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/shade/carrier/ShadeCarrierGroupControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/shade/carrier/ShadeCarrierGroupControllerTest.java @@ -23,6 +23,7 @@ import static org.junit.Assert.assertFalse; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.mock; @@ -109,6 +110,8 @@ public class ShadeCarrierGroupControllerTest extends LeakCheckedTest { .thenReturn(mCarrierTextControllerBuilder); when(mCarrierTextControllerBuilder.setShowMissingSim(anyBoolean())) .thenReturn(mCarrierTextControllerBuilder); + when(mCarrierTextControllerBuilder.setDebugLocationString(anyString())) + .thenReturn(mCarrierTextControllerBuilder); when(mCarrierTextControllerBuilder.build()).thenReturn(mCarrierTextManager); doAnswer(invocation -> mCallback = invocation.getArgument(0)) |