Merge "[Carrier text] add debug location to logs" into udc-dev
This commit is contained in:
@@ -39,7 +39,8 @@
|
|||||||
android:ellipsize="marquee"
|
android:ellipsize="marquee"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
androidprv:allCaps="@bool/kg_use_all_caps" />
|
androidprv:allCaps="@bool/kg_use_all_caps"
|
||||||
|
androidprv:debugLocation="Emergency" />
|
||||||
|
|
||||||
<com.android.keyguard.EmergencyButton
|
<com.android.keyguard.EmergencyButton
|
||||||
android:id="@+id/emergency_call_button"
|
android:id="@+id/emergency_call_button"
|
||||||
|
|||||||
@@ -78,6 +78,7 @@
|
|||||||
android:textColor="?attr/wallpaperTextColorSecondary"
|
android:textColor="?attr/wallpaperTextColorSecondary"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
systemui:showMissingSim="true"
|
systemui:showMissingSim="true"
|
||||||
systemui:showAirplaneMode="true" />
|
systemui:showAirplaneMode="true"
|
||||||
|
systemui:debugLocation="Keyguard" />
|
||||||
|
|
||||||
</com.android.systemui.statusbar.phone.KeyguardStatusBarView>
|
</com.android.systemui.statusbar.phone.KeyguardStatusBarView>
|
||||||
|
|||||||
@@ -146,6 +146,7 @@
|
|||||||
<attr name="allCaps" format="boolean" />
|
<attr name="allCaps" format="boolean" />
|
||||||
<attr name="showMissingSim" format="boolean" />
|
<attr name="showMissingSim" format="boolean" />
|
||||||
<attr name="showAirplaneMode" format="boolean" />
|
<attr name="showAirplaneMode" format="boolean" />
|
||||||
|
<attr name="debugLocation" format="string" />
|
||||||
</declare-styleable>
|
</declare-styleable>
|
||||||
|
|
||||||
<declare-styleable name="IlluminationDrawable">
|
<declare-styleable name="IlluminationDrawable">
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ public class CarrierText extends TextView {
|
|||||||
|
|
||||||
private final boolean mShowAirplaneMode;
|
private final boolean mShowAirplaneMode;
|
||||||
|
|
||||||
|
private final String mDebugLocation;
|
||||||
|
|
||||||
public CarrierText(Context context) {
|
public CarrierText(Context context) {
|
||||||
this(context, null);
|
this(context, null);
|
||||||
}
|
}
|
||||||
@@ -46,6 +48,7 @@ public class CarrierText extends TextView {
|
|||||||
useAllCaps = a.getBoolean(R.styleable.CarrierText_allCaps, false);
|
useAllCaps = a.getBoolean(R.styleable.CarrierText_allCaps, false);
|
||||||
mShowAirplaneMode = a.getBoolean(R.styleable.CarrierText_showAirplaneMode, false);
|
mShowAirplaneMode = a.getBoolean(R.styleable.CarrierText_showAirplaneMode, false);
|
||||||
mShowMissingSim = a.getBoolean(R.styleable.CarrierText_showMissingSim, false);
|
mShowMissingSim = a.getBoolean(R.styleable.CarrierText_showMissingSim, false);
|
||||||
|
mDebugLocation = a.getString(R.styleable.CarrierText_debugLocation);
|
||||||
} finally {
|
} finally {
|
||||||
a.recycle();
|
a.recycle();
|
||||||
}
|
}
|
||||||
@@ -70,6 +73,10 @@ public class CarrierText extends TextView {
|
|||||||
return mShowMissingSim;
|
return mShowMissingSim;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDebugLocation() {
|
||||||
|
return mDebugLocation;
|
||||||
|
}
|
||||||
|
|
||||||
private static class CarrierTextTransformationMethod extends SingleLineTransformationMethod {
|
private static class CarrierTextTransformationMethod extends SingleLineTransformationMethod {
|
||||||
private final Locale mLocale;
|
private final Locale mLocale;
|
||||||
private final boolean mAllCaps;
|
private final boolean mAllCaps;
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ public class CarrierTextController extends ViewController<CarrierText> {
|
|||||||
mCarrierTextManager = carrierTextManagerBuilder
|
mCarrierTextManager = carrierTextManagerBuilder
|
||||||
.setShowAirplaneMode(mView.getShowAirplaneMode())
|
.setShowAirplaneMode(mView.getShowAirplaneMode())
|
||||||
.setShowMissingSim(mView.getShowMissingSim())
|
.setShowMissingSim(mView.getShowMissingSim())
|
||||||
|
.setDebugLocationString(mView.getDebugLocation())
|
||||||
.build();
|
.build();
|
||||||
mKeyguardUpdateMonitor = keyguardUpdateMonitor;
|
mKeyguardUpdateMonitor = keyguardUpdateMonitor;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -651,6 +651,7 @@ public class CarrierTextManager {
|
|||||||
private final CarrierTextManagerLogger mLogger;
|
private final CarrierTextManagerLogger mLogger;
|
||||||
private boolean mShowAirplaneMode;
|
private boolean mShowAirplaneMode;
|
||||||
private boolean mShowMissingSim;
|
private boolean mShowMissingSim;
|
||||||
|
private String mDebugLocation;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public Builder(
|
public Builder(
|
||||||
@@ -689,14 +690,25 @@ public class CarrierTextManager {
|
|||||||
return this;
|
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. */
|
/** Create a CarrierTextManager. */
|
||||||
public CarrierTextManager build() {
|
public CarrierTextManager build() {
|
||||||
|
mLogger.setLocation(mDebugLocation);
|
||||||
return new CarrierTextManager(
|
return new CarrierTextManager(
|
||||||
mContext, mSeparator, mShowAirplaneMode, mShowMissingSim, mWifiRepository,
|
mContext, mSeparator, mShowAirplaneMode, mShowMissingSim, mWifiRepository,
|
||||||
mTelephonyManager, mTelephonyListenerManager, mWakefulnessLifecycle,
|
mTelephonyManager, mTelephonyListenerManager, mWakefulnessLifecycle,
|
||||||
mMainExecutor, mBgExecutor, mKeyguardUpdateMonitor, mLogger);
|
mMainExecutor, mBgExecutor, mKeyguardUpdateMonitor, mLogger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Data structure for passing information to CarrierTextController subscribers
|
* Data structure for passing information to CarrierTextController subscribers
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -18,15 +18,19 @@ package com.android.keyguard.logging
|
|||||||
|
|
||||||
import androidx.annotation.IntDef
|
import androidx.annotation.IntDef
|
||||||
import com.android.keyguard.CarrierTextManager.CarrierTextCallbackInfo
|
import com.android.keyguard.CarrierTextManager.CarrierTextCallbackInfo
|
||||||
import com.android.systemui.dagger.SysUISingleton
|
|
||||||
import com.android.systemui.log.LogBuffer
|
import com.android.systemui.log.LogBuffer
|
||||||
import com.android.systemui.log.LogLevel
|
import com.android.systemui.log.LogLevel
|
||||||
import com.android.systemui.log.dagger.CarrierTextManagerLog
|
import com.android.systemui.log.dagger.CarrierTextManagerLog
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
/** Logger adapter for [CarrierTextManager] to add detailed messages in a [LogBuffer] */
|
/** Logger adapter for [CarrierTextManager] to add detailed messages in a [LogBuffer] */
|
||||||
@SysUISingleton
|
|
||||||
class CarrierTextManagerLogger @Inject constructor(@CarrierTextManagerLog val buffer: LogBuffer) {
|
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
|
* This method and the methods below trace the execution of CarrierTextManager.updateCarrierText
|
||||||
*/
|
*/
|
||||||
@@ -35,7 +39,7 @@ class CarrierTextManagerLogger @Inject constructor(@CarrierTextManagerLog val bu
|
|||||||
TAG,
|
TAG,
|
||||||
LogLevel.VERBOSE,
|
LogLevel.VERBOSE,
|
||||||
{ int1 = numSubs },
|
{ int1 = numSubs },
|
||||||
{ "updateCarrierText: numSubs=$int1" },
|
{ "updateCarrierText: location=${location ?: "(unknown)"} numSubs=$int1" },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,7 +103,10 @@ class CarrierTextManagerLogger @Inject constructor(@CarrierTextManagerLog val bu
|
|||||||
TAG,
|
TAG,
|
||||||
LogLevel.DEBUG,
|
LogLevel.DEBUG,
|
||||||
{ int1 = reason },
|
{ int1 = reason },
|
||||||
{ "refreshing carrier info for reason: ${reason.reasonMessage()}" }
|
{
|
||||||
|
"refreshing carrier info for reason: ${reason.reasonMessage()}" +
|
||||||
|
" location=${location ?: "(unknown)"}"
|
||||||
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -141,6 +141,7 @@ public class ShadeCarrierGroupController {
|
|||||||
mCarrierTextManager = carrierTextManagerBuilder
|
mCarrierTextManager = carrierTextManagerBuilder
|
||||||
.setShowAirplaneMode(false)
|
.setShowAirplaneMode(false)
|
||||||
.setShowMissingSim(false)
|
.setShowMissingSim(false)
|
||||||
|
.setDebugLocationString("Shade")
|
||||||
.build();
|
.build();
|
||||||
mCarrierConfigTracker = carrierConfigTracker;
|
mCarrierConfigTracker = carrierConfigTracker;
|
||||||
mSlotIndexResolver = slotIndexResolver;
|
mSlotIndexResolver = slotIndexResolver;
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import static org.junit.Assert.assertFalse;
|
|||||||
import static org.mockito.ArgumentMatchers.any;
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
import static org.mockito.ArgumentMatchers.anyBoolean;
|
import static org.mockito.ArgumentMatchers.anyBoolean;
|
||||||
import static org.mockito.ArgumentMatchers.anyInt;
|
import static org.mockito.ArgumentMatchers.anyInt;
|
||||||
|
import static org.mockito.ArgumentMatchers.anyString;
|
||||||
import static org.mockito.ArgumentMatchers.eq;
|
import static org.mockito.ArgumentMatchers.eq;
|
||||||
import static org.mockito.Mockito.doAnswer;
|
import static org.mockito.Mockito.doAnswer;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
@@ -109,6 +110,8 @@ public class ShadeCarrierGroupControllerTest extends LeakCheckedTest {
|
|||||||
.thenReturn(mCarrierTextControllerBuilder);
|
.thenReturn(mCarrierTextControllerBuilder);
|
||||||
when(mCarrierTextControllerBuilder.setShowMissingSim(anyBoolean()))
|
when(mCarrierTextControllerBuilder.setShowMissingSim(anyBoolean()))
|
||||||
.thenReturn(mCarrierTextControllerBuilder);
|
.thenReturn(mCarrierTextControllerBuilder);
|
||||||
|
when(mCarrierTextControllerBuilder.setDebugLocationString(anyString()))
|
||||||
|
.thenReturn(mCarrierTextControllerBuilder);
|
||||||
when(mCarrierTextControllerBuilder.build()).thenReturn(mCarrierTextManager);
|
when(mCarrierTextControllerBuilder.build()).thenReturn(mCarrierTextManager);
|
||||||
|
|
||||||
doAnswer(invocation -> mCallback = invocation.getArgument(0))
|
doAnswer(invocation -> mCallback = invocation.getArgument(0))
|
||||||
|
|||||||
Reference in New Issue
Block a user