Merge "Move carrier package to shade" into udc-dev

This commit is contained in:
Fabian Kozynski
2023-04-06 17:40:05 +00:00
committed by Android (Google) Code Review
17 changed files with 168 additions and 165 deletions

View File

@@ -94,7 +94,7 @@
<include <include
android:id="@+id/carrier_group" android:id="@+id/carrier_group"
layout="@layout/qs_carrier_group" layout="@layout/shade_carrier_group"
app:layout_constraintHeight_min="@dimen/large_screen_shade_header_min_height" app:layout_constraintHeight_min="@dimen/large_screen_shade_header_min_height"
android:minHeight="@dimen/large_screen_shade_header_min_height" android:minHeight="@dimen/large_screen_shade_header_min_height"
app:layout_constraintWidth_min="48dp" app:layout_constraintWidth_min="48dp"

View File

@@ -14,7 +14,7 @@
~ limitations under the License ~ limitations under the License
--> -->
<com.android.systemui.qs.carrier.QSCarrier <com.android.systemui.shade.carrier.ShadeCarrier
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linear_carrier" android:id="@+id/linear_carrier"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@@ -29,7 +29,7 @@
android:focusable="true" > android:focusable="true" >
<com.android.systemui.util.AutoMarqueeTextView <com.android.systemui.util.AutoMarqueeTextView
android:id="@+id/qs_carrier_text" android:id="@+id/shade_carrier_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
@@ -53,4 +53,4 @@
android:layout_marginStart="@dimen/qs_carrier_margin_width" android:layout_marginStart="@dimen/qs_carrier_margin_width"
android:visibility="gone" /> android:visibility="gone" />
</com.android.systemui.qs.carrier.QSCarrier> </com.android.systemui.shade.carrier.ShadeCarrier>

View File

@@ -15,7 +15,7 @@
--> -->
<!-- Extends LinearLayout --> <!-- Extends LinearLayout -->
<com.android.systemui.qs.carrier.QSCarrierGroup <com.android.systemui.shade.carrier.ShadeCarrierGroup
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/qs_mobile" android:id="@+id/qs_mobile"
android:layout_width="0dp" android:layout_width="0dp"
@@ -39,25 +39,25 @@
android:visibility="gone"/> android:visibility="gone"/>
<include <include
layout="@layout/qs_carrier" layout="@layout/shade_carrier"
android:id="@+id/carrier1" android:id="@+id/carrier1"
android:layout_weight="1"/> android:layout_weight="1"/>
<View <View
android:id="@+id/qs_carrier_divider1" android:id="@+id/shade_carrier_divider1"
android:layout_width="@dimen/qs_header_carrier_separator_width" android:layout_width="@dimen/qs_header_carrier_separator_width"
android:layout_height="match_parent" android:layout_height="match_parent"
android:visibility="gone" android:visibility="gone"
android:importantForAccessibility="no"/> android:importantForAccessibility="no"/>
<include <include
layout="@layout/qs_carrier" layout="@layout/shade_carrier"
android:id="@+id/carrier2" android:id="@+id/carrier2"
android:layout_weight="1" android:layout_weight="1"
android:visibility="gone"/> android:visibility="gone"/>
<View <View
android:id="@+id/qs_carrier_divider2" android:id="@+id/shade_carrier_divider2"
android:layout_width="@dimen/qs_header_carrier_separator_width" android:layout_width="@dimen/qs_header_carrier_separator_width"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
@@ -65,9 +65,9 @@
android:importantForAccessibility="no"/> android:importantForAccessibility="no"/>
<include <include
layout="@layout/qs_carrier" layout="@layout/shade_carrier"
android:id="@+id/carrier3" android:id="@+id/carrier3"
android:layout_weight="1" android:layout_weight="1"
android:visibility="gone"/> android:visibility="gone"/>
</com.android.systemui.qs.carrier.QSCarrierGroup> </com.android.systemui.shade.carrier.ShadeCarrierGroup>

View File

@@ -36,7 +36,7 @@
fade_out_complete_frame --> fade_out_complete_frame -->
<dimen name="percent_displacement_at_fade_out" format="float">0.1066</dimen> <dimen name="percent_displacement_at_fade_out" format="float">0.1066</dimen>
<integer name="qs_carrier_max_em">7</integer> <integer name="shade_carrier_max_em">7</integer>
<!-- Maximum number of notification icons shown on the Always on Display <!-- Maximum number of notification icons shown on the Always on Display
(excluding overflow dot) --> (excluding overflow dot) -->

View File

@@ -43,13 +43,13 @@ import com.android.systemui.demomode.DemoModeController
import com.android.systemui.dump.DumpManager import com.android.systemui.dump.DumpManager
import com.android.systemui.qs.ChipVisibilityListener import com.android.systemui.qs.ChipVisibilityListener
import com.android.systemui.qs.HeaderPrivacyIconsController import com.android.systemui.qs.HeaderPrivacyIconsController
import com.android.systemui.qs.carrier.QSCarrierGroup
import com.android.systemui.qs.carrier.QSCarrierGroupController
import com.android.systemui.shade.ShadeHeaderController.Companion.HEADER_TRANSITION_ID import com.android.systemui.shade.ShadeHeaderController.Companion.HEADER_TRANSITION_ID
import com.android.systemui.shade.ShadeHeaderController.Companion.LARGE_SCREEN_HEADER_CONSTRAINT import com.android.systemui.shade.ShadeHeaderController.Companion.LARGE_SCREEN_HEADER_CONSTRAINT
import com.android.systemui.shade.ShadeHeaderController.Companion.LARGE_SCREEN_HEADER_TRANSITION_ID import com.android.systemui.shade.ShadeHeaderController.Companion.LARGE_SCREEN_HEADER_TRANSITION_ID
import com.android.systemui.shade.ShadeHeaderController.Companion.QQS_HEADER_CONSTRAINT import com.android.systemui.shade.ShadeHeaderController.Companion.QQS_HEADER_CONSTRAINT
import com.android.systemui.shade.ShadeHeaderController.Companion.QS_HEADER_CONSTRAINT import com.android.systemui.shade.ShadeHeaderController.Companion.QS_HEADER_CONSTRAINT
import com.android.systemui.shade.carrier.ShadeCarrierGroup
import com.android.systemui.shade.carrier.ShadeCarrierGroupController
import com.android.systemui.statusbar.phone.StatusBarContentInsetsProvider import com.android.systemui.statusbar.phone.StatusBarContentInsetsProvider
import com.android.systemui.statusbar.phone.StatusBarIconController import com.android.systemui.statusbar.phone.StatusBarIconController
import com.android.systemui.statusbar.phone.StatusBarLocation import com.android.systemui.statusbar.phone.StatusBarLocation
@@ -87,7 +87,7 @@ constructor(
private val variableDateViewControllerFactory: VariableDateViewController.Factory, private val variableDateViewControllerFactory: VariableDateViewController.Factory,
@Named(SHADE_HEADER) private val batteryMeterViewController: BatteryMeterViewController, @Named(SHADE_HEADER) private val batteryMeterViewController: BatteryMeterViewController,
private val dumpManager: DumpManager, private val dumpManager: DumpManager,
private val qsCarrierGroupControllerBuilder: QSCarrierGroupController.Builder, private val shadeCarrierGroupControllerBuilder: ShadeCarrierGroupController.Builder,
private val combinedShadeHeadersConstraintManager: CombinedShadeHeadersConstraintManager, private val combinedShadeHeadersConstraintManager: CombinedShadeHeadersConstraintManager,
private val demoModeController: DemoModeController, private val demoModeController: DemoModeController,
private val qsBatteryModeController: QsBatteryModeController, private val qsBatteryModeController: QsBatteryModeController,
@@ -114,13 +114,13 @@ constructor(
private lateinit var iconManager: StatusBarIconController.TintedIconManager private lateinit var iconManager: StatusBarIconController.TintedIconManager
private lateinit var carrierIconSlots: List<String> private lateinit var carrierIconSlots: List<String>
private lateinit var qsCarrierGroupController: QSCarrierGroupController private lateinit var mShadeCarrierGroupController: ShadeCarrierGroupController
private val batteryIcon: BatteryMeterView = header.findViewById(R.id.batteryRemainingIcon) private val batteryIcon: BatteryMeterView = header.findViewById(R.id.batteryRemainingIcon)
private val clock: Clock = header.findViewById(R.id.clock) private val clock: Clock = header.findViewById(R.id.clock)
private val date: TextView = header.findViewById(R.id.date) private val date: TextView = header.findViewById(R.id.date)
private val iconContainer: StatusIconContainer = header.findViewById(R.id.statusIcons) private val iconContainer: StatusIconContainer = header.findViewById(R.id.statusIcons)
private val qsCarrierGroup: QSCarrierGroup = header.findViewById(R.id.carrier_group) private val mShadeCarrierGroup: ShadeCarrierGroup = header.findViewById(R.id.carrier_group)
private var roundedCorners = 0 private var roundedCorners = 0
private var cutout: DisplayCutout? = null private var cutout: DisplayCutout? = null
@@ -243,7 +243,7 @@ constructor(
override fun onDensityOrFontScaleChanged() { override fun onDensityOrFontScaleChanged() {
clock.setTextAppearance(R.style.TextAppearance_QS_Status) clock.setTextAppearance(R.style.TextAppearance_QS_Status)
date.setTextAppearance(R.style.TextAppearance_QS_Status) date.setTextAppearance(R.style.TextAppearance_QS_Status)
qsCarrierGroup.updateTextAppearance(R.style.TextAppearance_QS_Status_Carriers) mShadeCarrierGroup.updateTextAppearance(R.style.TextAppearance_QS_Status_Carriers)
loadConstraints() loadConstraints()
header.minHeight = header.minHeight =
resources.getDimensionPixelSize(R.dimen.large_screen_shade_header_min_height) resources.getDimensionPixelSize(R.dimen.large_screen_shade_header_min_height)
@@ -266,8 +266,8 @@ constructor(
carrierIconSlots = carrierIconSlots =
listOf(header.context.getString(com.android.internal.R.string.status_bar_mobile)) listOf(header.context.getString(com.android.internal.R.string.status_bar_mobile))
qsCarrierGroupController = mShadeCarrierGroupController =
qsCarrierGroupControllerBuilder.setQSCarrierGroup(qsCarrierGroup).build() shadeCarrierGroupControllerBuilder.setShadeCarrierGroup(mShadeCarrierGroup).build()
privacyIconsController.onParentVisible() privacyIconsController.onParentVisible()
} }
@@ -284,7 +284,7 @@ constructor(
v.pivotX = newPivot v.pivotX = newPivot
v.pivotY = v.height.toFloat() / 2 v.pivotY = v.height.toFloat() / 2
qsCarrierGroup.setPaddingRelative((v.width * v.scaleX).toInt(), 0, 0, 0) mShadeCarrierGroup.setPaddingRelative((v.width * v.scaleX).toInt(), 0, 0, 0)
} }
dumpManager.registerDumpable(this) dumpManager.registerDumpable(this)
@@ -439,12 +439,14 @@ constructor(
} }
private fun updateListeners() { private fun updateListeners() {
qsCarrierGroupController.setListening(visible) mShadeCarrierGroupController.setListening(visible)
if (visible) { if (visible) {
updateSingleCarrier(qsCarrierGroupController.isSingleCarrier) updateSingleCarrier(mShadeCarrierGroupController.isSingleCarrier)
qsCarrierGroupController.setOnSingleCarrierChangedListener { updateSingleCarrier(it) } mShadeCarrierGroupController.setOnSingleCarrierChangedListener {
updateSingleCarrier(it)
}
} else { } else {
qsCarrierGroupController.setOnSingleCarrierChangedListener(null) mShadeCarrierGroupController.setOnSingleCarrierChangedListener(null)
} }
} }

View File

@@ -1,11 +1,11 @@
/* /*
* Copyright (C) 2020 The Android Open Source Project * Copyright (C) 2023 The Android Open Source Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,12 +14,12 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.systemui.qs.carrier package com.android.systemui.shade.carrier
/** /**
* Represents the state of cell signal for a particular slot. * Represents the state of cell signal for a particular slot.
* *
* To be used between [QSCarrierGroupController] and [QSCarrier]. * To be used between [ShadeCarrierGroupController] and [ShadeCarrier].
*/ */
data class CellSignalState( data class CellSignalState(
@JvmField val visible: Boolean = false, @JvmField val visible: Boolean = false,
@@ -37,7 +37,6 @@ data class CellSignalState(
* @return `this` if `this.visible == visible`. Else, a new copy with the visibility changed. * @return `this` if `this.visible == visible`. Else, a new copy with the visibility changed.
*/ */
fun changeVisibility(visible: Boolean): CellSignalState { fun changeVisibility(visible: Boolean): CellSignalState {
if (this.visible == visible) return this if (this.visible == visible) return this else return copy(visible = visible)
else return copy(visible = visible)
} }
} }

View File

@@ -1,11 +1,11 @@
/* /*
* Copyright (C) 2020 The Android Open Source Project * Copyright (C) 2023 The Android Open Source Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.systemui.qs.carrier; package com.android.systemui.shade.carrier;
import android.annotation.StyleRes; import android.annotation.StyleRes;
import android.content.Context; import android.content.Context;
@@ -38,7 +38,7 @@ import com.android.systemui.util.LargeScreenUtils;
import java.util.Objects; import java.util.Objects;
public class QSCarrier extends LinearLayout { public class ShadeCarrier extends LinearLayout {
private View mMobileGroup; private View mMobileGroup;
private TextView mCarrierText; private TextView mCarrierText;
@@ -50,19 +50,19 @@ public class QSCarrier extends LinearLayout {
private boolean mMobileSignalInitialized = false; private boolean mMobileSignalInitialized = false;
private boolean mIsSingleCarrier; private boolean mIsSingleCarrier;
public QSCarrier(Context context) { public ShadeCarrier(Context context) {
super(context); super(context);
} }
public QSCarrier(Context context, AttributeSet attrs) { public ShadeCarrier(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
} }
public QSCarrier(Context context, AttributeSet attrs, int defStyleAttr) { public ShadeCarrier(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr); super(context, attrs, defStyleAttr);
} }
public QSCarrier(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { public ShadeCarrier(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes); super(context, attrs, defStyleAttr, defStyleRes);
} }
@@ -72,7 +72,7 @@ public class QSCarrier extends LinearLayout {
mMobileGroup = findViewById(R.id.mobile_combo); mMobileGroup = findViewById(R.id.mobile_combo);
mMobileRoaming = findViewById(R.id.mobile_roaming); mMobileRoaming = findViewById(R.id.mobile_roaming);
mMobileSignal = findViewById(R.id.mobile_signal); mMobileSignal = findViewById(R.id.mobile_signal);
mCarrierText = findViewById(R.id.qs_carrier_text); mCarrierText = findViewById(R.id.shade_carrier_text);
mSpacer = findViewById(R.id.spacer); mSpacer = findViewById(R.id.spacer);
updateResources(); updateResources();
} }
@@ -158,7 +158,7 @@ public class QSCarrier extends LinearLayout {
mCarrierText.setMaxEms( mCarrierText.setMaxEms(
useLargeScreenHeader useLargeScreenHeader
? Integer.MAX_VALUE ? Integer.MAX_VALUE
: getResources().getInteger(R.integer.qs_carrier_max_em) : getResources().getInteger(R.integer.shade_carrier_max_em)
); );
} }
} }

View File

@@ -1,11 +1,11 @@
/* /*
* Copyright (C) 2020 The Android Open Source Project * Copyright (C) 2023 The Android Open Source Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.systemui.qs.carrier; package com.android.systemui.shade.carrier;
import android.annotation.StyleRes; import android.annotation.StyleRes;
import android.content.Context; import android.content.Context;
@@ -27,10 +27,10 @@ import com.android.systemui.FontSizeUtils;
import com.android.systemui.R; import com.android.systemui.R;
/** /**
* Displays Carrier name and network status in QS * Displays Carrier name and network status in the shade header
*/ */
public class QSCarrierGroup extends LinearLayout { public class ShadeCarrierGroup extends LinearLayout {
public QSCarrierGroup(Context context, AttributeSet attrs) { public ShadeCarrierGroup(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
} }
@@ -38,24 +38,24 @@ public class QSCarrierGroup extends LinearLayout {
return findViewById(R.id.no_carrier_text); return findViewById(R.id.no_carrier_text);
} }
QSCarrier getCarrier1View() { ShadeCarrier getCarrier1View() {
return findViewById(R.id.carrier1); return findViewById(R.id.carrier1);
} }
QSCarrier getCarrier2View() { ShadeCarrier getCarrier2View() {
return findViewById(R.id.carrier2); return findViewById(R.id.carrier2);
} }
QSCarrier getCarrier3View() { ShadeCarrier getCarrier3View() {
return findViewById(R.id.carrier3); return findViewById(R.id.carrier3);
} }
View getCarrierDivider1() { View getCarrierDivider1() {
return findViewById(R.id.qs_carrier_divider1); return findViewById(R.id.shade_carrier_divider1);
} }
View getCarrierDivider2() { View getCarrierDivider2() {
return findViewById(R.id.qs_carrier_divider2); return findViewById(R.id.shade_carrier_divider2);
} }
public void updateTextAppearance(@StyleRes int resId) { public void updateTextAppearance(@StyleRes int resId) {

View File

@@ -1,11 +1,11 @@
/* /*
* Copyright (C) 2020 The Android Open Source Project * Copyright (C) 2023 The Android Open Source Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.systemui.qs.carrier; package com.android.systemui.shade.carrier;
import static android.view.View.IMPORTANT_FOR_ACCESSIBILITY_YES; import static android.view.View.IMPORTANT_FOR_ACCESSIBILITY_YES;
@@ -52,8 +52,8 @@ import java.util.function.Consumer;
import javax.inject.Inject; import javax.inject.Inject;
public class QSCarrierGroupController { public class ShadeCarrierGroupController {
private static final String TAG = "QSCarrierGroup"; private static final String TAG = "ShadeCarrierGroup";
/** /**
* Support up to 3 slots which is what's supported by {@link TelephonyManager#getPhoneCount} * Support up to 3 slots which is what's supported by {@link TelephonyManager#getPhoneCount}
@@ -72,7 +72,7 @@ public class QSCarrierGroupController {
private final CellSignalState[] mInfos = private final CellSignalState[] mInfos =
new CellSignalState[SIM_SLOTS]; new CellSignalState[SIM_SLOTS];
private View[] mCarrierDividers = new View[SIM_SLOTS - 1]; private View[] mCarrierDividers = new View[SIM_SLOTS - 1];
private QSCarrier[] mCarrierGroups = new QSCarrier[SIM_SLOTS]; private ShadeCarrier[] mCarrierGroups = new ShadeCarrier[SIM_SLOTS];
private int[] mLastSignalLevel = new int[SIM_SLOTS]; private int[] mLastSignalLevel = new int[SIM_SLOTS];
private String[] mLastSignalLevelDescription = new String[SIM_SLOTS]; private String[] mLastSignalLevelDescription = new String[SIM_SLOTS];
private final CarrierConfigTracker mCarrierConfigTracker; private final CarrierConfigTracker mCarrierConfigTracker;
@@ -129,7 +129,7 @@ public class QSCarrierGroupController {
} }
} }
private QSCarrierGroupController(QSCarrierGroup view, ActivityStarter activityStarter, private ShadeCarrierGroupController(ShadeCarrierGroup view, ActivityStarter activityStarter,
@Background Handler bgHandler, @Main Looper mainLooper, @Background Handler bgHandler, @Main Looper mainLooper,
NetworkController networkController, NetworkController networkController,
CarrierTextManager.Builder carrierTextManagerBuilder, Context context, CarrierTextManager.Builder carrierTextManagerBuilder, Context context,
@@ -167,7 +167,7 @@ public class QSCarrierGroupController {
for (int i = 0; i < SIM_SLOTS; i++) { for (int i = 0; i < SIM_SLOTS; i++) {
mInfos[i] = new CellSignalState( mInfos[i] = new CellSignalState(
true, true,
R.drawable.ic_qs_no_calling_sms, R.drawable.ic_shade_no_calling_sms,
context.getText(AccessibilityContentDescriptions.NO_CALLING).toString(), context.getText(AccessibilityContentDescriptions.NO_CALLING).toString(),
"", "",
false); false);
@@ -257,7 +257,7 @@ public class QSCarrierGroupController {
if (singleCarrier) { if (singleCarrier) {
for (int i = 0; i < SIM_SLOTS; i++) { for (int i = 0; i < SIM_SLOTS; i++) {
if (mInfos[i].visible if (mInfos[i].visible
&& mInfos[i].mobileSignalIconId == R.drawable.ic_qs_sim_card) { && mInfos[i].mobileSignalIconId == R.drawable.ic_shade_sim_card) {
mInfos[i] = new CellSignalState(true, R.drawable.ic_blank, "", "", false); mInfos[i] = new CellSignalState(true, R.drawable.ic_blank, "", "", false);
} }
} }
@@ -322,8 +322,8 @@ public class QSCarrierGroupController {
Log.e(TAG, "Carrier information arrays not of same length"); Log.e(TAG, "Carrier information arrays not of same length");
} }
} else { } else {
// No sims or airplane mode (but not WFC). Do not show QSCarrierGroup, instead just show // No sims or airplane mode (but not WFC). Do not show ShadeCarrierGroup,
// info.carrierText in a different view. // instead just show info.carrierText in a different view.
for (int i = 0; i < SIM_SLOTS; i++) { for (int i = 0; i < SIM_SLOTS; i++) {
mInfos[i] = mInfos[i].changeVisibility(false); mInfos[i] = mInfos[i].changeVisibility(false);
mCarrierGroups[i].setCarrierText(""); mCarrierGroups[i].setCarrierText("");
@@ -368,7 +368,7 @@ public class QSCarrierGroupController {
} }
public static class Builder { public static class Builder {
private QSCarrierGroup mView; private ShadeCarrierGroup mView;
private final ActivityStarter mActivityStarter; private final ActivityStarter mActivityStarter;
private final Handler mHandler; private final Handler mHandler;
private final Looper mLooper; private final Looper mLooper;
@@ -393,13 +393,13 @@ public class QSCarrierGroupController {
mSlotIndexResolver = slotIndexResolver; mSlotIndexResolver = slotIndexResolver;
} }
public Builder setQSCarrierGroup(QSCarrierGroup view) { public Builder setShadeCarrierGroup(ShadeCarrierGroup view) {
mView = view; mView = view;
return this; return this;
} }
public QSCarrierGroupController build() { public ShadeCarrierGroupController build() {
return new QSCarrierGroupController(mView, mActivityStarter, mHandler, mLooper, return new ShadeCarrierGroupController(mView, mActivityStarter, mHandler, mLooper,
mNetworkController, mCarrierTextControllerBuilder, mContext, mNetworkController, mCarrierTextControllerBuilder, mContext,
mCarrierConfigTracker, mSlotIndexResolver); mCarrierConfigTracker, mSlotIndexResolver);
} }

View File

@@ -38,8 +38,8 @@ import com.android.systemui.keyguard.domain.interactor.AlternateBouncerInteracto
import com.android.systemui.media.controls.pipeline.MediaDataManager; import com.android.systemui.media.controls.pipeline.MediaDataManager;
import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.qs.carrier.QSCarrierGroupController;
import com.android.systemui.settings.DisplayTracker; import com.android.systemui.settings.DisplayTracker;
import com.android.systemui.shade.carrier.ShadeCarrierGroupController;
import com.android.systemui.statusbar.ActionClickLogger; import com.android.systemui.statusbar.ActionClickLogger;
import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.MediaArtworkProcessor; import com.android.systemui.statusbar.MediaArtworkProcessor;
@@ -78,14 +78,14 @@ import com.android.systemui.tracing.ProtoTracer;
import com.android.systemui.util.concurrency.DelayableExecutor; import com.android.systemui.util.concurrency.DelayableExecutor;
import com.android.systemui.util.time.SystemClock; import com.android.systemui.util.time.SystemClock;
import java.util.Optional;
import java.util.concurrent.Executor;
import dagger.Binds; import dagger.Binds;
import dagger.Lazy; import dagger.Lazy;
import dagger.Module; import dagger.Module;
import dagger.Provides; import dagger.Provides;
import java.util.Optional;
import java.util.concurrent.Executor;
/** /**
* This module provides instances needed to construct {@link CentralSurfacesImpl}. These are moved to * This module provides instances needed to construct {@link CentralSurfacesImpl}. These are moved to
* this separate from {@link CentralSurfacesModule} module so that components that wish to build * this separate from {@link CentralSurfacesModule} module so that components that wish to build
@@ -271,8 +271,8 @@ public interface CentralSurfacesDependenciesModule {
/** */ /** */
@Binds @Binds
QSCarrierGroupController.SlotIndexResolver provideSlotIndexResolver( ShadeCarrierGroupController.SlotIndexResolver provideSlotIndexResolver(
QSCarrierGroupController.SubscriptionManagerSlotIndexResolver impl); ShadeCarrierGroupController.SubscriptionManagerSlotIndexResolver impl);
/** /**
*/ */

View File

@@ -230,7 +230,7 @@ public class StatusBarSignalPolicy implements SignalCallback,
if (state == null) { if (state == null) {
return; return;
} }
if (statusIcon.icon == R.drawable.ic_qs_no_calling_sms) { if (statusIcon.icon == R.drawable.ic_shade_no_calling_sms) {
state.isNoCalling = statusIcon.visible; state.isNoCalling = statusIcon.visible;
state.noCallingDescription = statusIcon.contentDescription; state.noCallingDescription = statusIcon.contentDescription;
} else { } else {
@@ -422,7 +422,7 @@ public class StatusBarSignalPolicy implements SignalCallback,
private CallIndicatorIconState(int subId) { private CallIndicatorIconState(int subId) {
this.subId = subId; this.subId = subId;
this.noCallingResId = R.drawable.ic_qs_no_calling_sms; this.noCallingResId = R.drawable.ic_shade_no_calling_sms;
this.callStrengthResId = TelephonyIcons.MOBILE_CALL_STRENGTH_ICONS[0]; this.callStrengthResId = TelephonyIcons.MOBILE_CALL_STRENGTH_ICONS[0];
} }

View File

@@ -42,11 +42,11 @@ import com.android.systemui.demomode.DemoModeController
import com.android.systemui.dump.DumpManager import com.android.systemui.dump.DumpManager
import com.android.systemui.qs.ChipVisibilityListener import com.android.systemui.qs.ChipVisibilityListener
import com.android.systemui.qs.HeaderPrivacyIconsController import com.android.systemui.qs.HeaderPrivacyIconsController
import com.android.systemui.qs.carrier.QSCarrierGroup
import com.android.systemui.qs.carrier.QSCarrierGroupController
import com.android.systemui.shade.ShadeHeaderController.Companion.LARGE_SCREEN_HEADER_CONSTRAINT import com.android.systemui.shade.ShadeHeaderController.Companion.LARGE_SCREEN_HEADER_CONSTRAINT
import com.android.systemui.shade.ShadeHeaderController.Companion.QQS_HEADER_CONSTRAINT import com.android.systemui.shade.ShadeHeaderController.Companion.QQS_HEADER_CONSTRAINT
import com.android.systemui.shade.ShadeHeaderController.Companion.QS_HEADER_CONSTRAINT import com.android.systemui.shade.ShadeHeaderController.Companion.QS_HEADER_CONSTRAINT
import com.android.systemui.shade.carrier.ShadeCarrierGroup
import com.android.systemui.shade.carrier.ShadeCarrierGroupController
import com.android.systemui.statusbar.phone.StatusBarContentInsetsProvider import com.android.systemui.statusbar.phone.StatusBarContentInsetsProvider
import com.android.systemui.statusbar.phone.StatusBarIconController import com.android.systemui.statusbar.phone.StatusBarIconController
import com.android.systemui.statusbar.phone.StatusIconContainer import com.android.systemui.statusbar.phone.StatusIconContainer
@@ -88,11 +88,12 @@ class ShadeHeaderControllerTest : SysuiTestCase() {
@Mock private lateinit var statusBarIconController: StatusBarIconController @Mock private lateinit var statusBarIconController: StatusBarIconController
@Mock private lateinit var iconManagerFactory: StatusBarIconController.TintedIconManager.Factory @Mock private lateinit var iconManagerFactory: StatusBarIconController.TintedIconManager.Factory
@Mock private lateinit var iconManager: StatusBarIconController.TintedIconManager @Mock private lateinit var iconManager: StatusBarIconController.TintedIconManager
@Mock private lateinit var qsCarrierGroupController: QSCarrierGroupController @Mock private lateinit var mShadeCarrierGroupController: ShadeCarrierGroupController
@Mock private lateinit var qsCarrierGroupControllerBuilder: QSCarrierGroupController.Builder @Mock
private lateinit var mShadeCarrierGroupControllerBuilder: ShadeCarrierGroupController.Builder
@Mock private lateinit var clock: Clock @Mock private lateinit var clock: Clock
@Mock private lateinit var date: VariableDateView @Mock private lateinit var date: VariableDateView
@Mock private lateinit var carrierGroup: QSCarrierGroup @Mock private lateinit var carrierGroup: ShadeCarrierGroup
@Mock private lateinit var batteryMeterView: BatteryMeterView @Mock private lateinit var batteryMeterView: BatteryMeterView
@Mock private lateinit var batteryMeterViewController: BatteryMeterViewController @Mock private lateinit var batteryMeterViewController: BatteryMeterViewController
@Mock private lateinit var privacyIconsController: HeaderPrivacyIconsController @Mock private lateinit var privacyIconsController: HeaderPrivacyIconsController
@@ -131,7 +132,7 @@ class ShadeHeaderControllerTest : SysuiTestCase() {
whenever<TextView>(view.findViewById(R.id.date)).thenReturn(date) whenever<TextView>(view.findViewById(R.id.date)).thenReturn(date)
whenever(date.context).thenReturn(mockedContext) whenever(date.context).thenReturn(mockedContext)
whenever<QSCarrierGroup>(view.findViewById(R.id.carrier_group)).thenReturn(carrierGroup) whenever<ShadeCarrierGroup>(view.findViewById(R.id.carrier_group)).thenReturn(carrierGroup)
whenever<BatteryMeterView>(view.findViewById(R.id.batteryRemainingIcon)) whenever<BatteryMeterView>(view.findViewById(R.id.batteryRemainingIcon))
.thenReturn(batteryMeterView) .thenReturn(batteryMeterView)
@@ -142,9 +143,10 @@ class ShadeHeaderControllerTest : SysuiTestCase() {
whenever(view.context).thenReturn(viewContext) whenever(view.context).thenReturn(viewContext)
whenever(view.resources).thenReturn(context.resources) whenever(view.resources).thenReturn(context.resources)
whenever(statusIcons.context).thenReturn(context) whenever(statusIcons.context).thenReturn(context)
whenever(qsCarrierGroupControllerBuilder.setQSCarrierGroup(any())) whenever(mShadeCarrierGroupControllerBuilder.setShadeCarrierGroup(any()))
.thenReturn(qsCarrierGroupControllerBuilder) .thenReturn(mShadeCarrierGroupControllerBuilder)
whenever(qsCarrierGroupControllerBuilder.build()).thenReturn(qsCarrierGroupController) whenever(mShadeCarrierGroupControllerBuilder.build())
.thenReturn(mShadeCarrierGroupController)
whenever(view.setVisibility(anyInt())).then { whenever(view.setVisibility(anyInt())).then {
viewVisibility = it.arguments[0] as Int viewVisibility = it.arguments[0] as Int
null null
@@ -175,7 +177,7 @@ class ShadeHeaderControllerTest : SysuiTestCase() {
variableDateViewControllerFactory, variableDateViewControllerFactory,
batteryMeterViewController, batteryMeterViewController,
dumpManager, dumpManager,
qsCarrierGroupControllerBuilder, mShadeCarrierGroupControllerBuilder,
combinedShadeHeadersConstraintManager, combinedShadeHeadersConstraintManager,
demoModeController, demoModeController,
qsBatteryModeController, qsBatteryModeController,
@@ -189,7 +191,7 @@ class ShadeHeaderControllerTest : SysuiTestCase() {
@Test @Test
fun updateListeners_registersWhenVisible() { fun updateListeners_registersWhenVisible() {
makeShadeVisible() makeShadeVisible()
verify(qsCarrierGroupController).setListening(true) verify(mShadeCarrierGroupController).setListening(true)
verify(statusBarIconController).addIconGroup(any()) verify(statusBarIconController).addIconGroup(any())
} }
@@ -213,7 +215,7 @@ class ShadeHeaderControllerTest : SysuiTestCase() {
@Test @Test
fun singleCarrier_enablesCarrierIconsInStatusIcons() { fun singleCarrier_enablesCarrierIconsInStatusIcons() {
whenever(qsCarrierGroupController.isSingleCarrier).thenReturn(true) whenever(mShadeCarrierGroupController.isSingleCarrier).thenReturn(true)
makeShadeVisible() makeShadeVisible()
@@ -222,7 +224,7 @@ class ShadeHeaderControllerTest : SysuiTestCase() {
@Test @Test
fun dualCarrier_disablesCarrierIconsInStatusIcons() { fun dualCarrier_disablesCarrierIconsInStatusIcons() {
whenever(qsCarrierGroupController.isSingleCarrier).thenReturn(false) whenever(mShadeCarrierGroupController.isSingleCarrier).thenReturn(false)
makeShadeVisible() makeShadeVisible()
@@ -349,9 +351,9 @@ class ShadeHeaderControllerTest : SysuiTestCase() {
verify(batteryMeterViewController).init() verify(batteryMeterViewController).init()
verify(batteryMeterViewController).ignoreTunerUpdates() verify(batteryMeterViewController).ignoreTunerUpdates()
val inOrder = Mockito.inOrder(qsCarrierGroupControllerBuilder) val inOrder = Mockito.inOrder(mShadeCarrierGroupControllerBuilder)
inOrder.verify(qsCarrierGroupControllerBuilder).setQSCarrierGroup(carrierGroup) inOrder.verify(mShadeCarrierGroupControllerBuilder).setShadeCarrierGroup(carrierGroup)
inOrder.verify(qsCarrierGroupControllerBuilder).build() inOrder.verify(mShadeCarrierGroupControllerBuilder).build()
} }
@Test @Test

View File

@@ -1,11 +1,11 @@
/* /*
* Copyright (C) 2020 The Android Open Source Project * Copyright (C) 2023 The Android Open Source Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.systemui.qs.carrier package com.android.systemui.shade.carrier
import android.testing.AndroidTestingRunner import android.testing.AndroidTestingRunner
import androidx.test.filters.SmallTest import androidx.test.filters.SmallTest
@@ -45,4 +45,4 @@ class CellSignalStateTest : SysuiTestCase() {
assertNotSame(c, other) assertNotSame(c, other)
} }
} }

View File

@@ -1,11 +1,11 @@
/* /*
* Copyright (C) 2020 The Android Open Source Project * Copyright (C) 2023 The Android Open Source Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.systemui.qs.carrier; package com.android.systemui.shade.carrier;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
@@ -63,13 +63,13 @@ import org.mockito.MockitoAnnotations;
@RunWith(AndroidTestingRunner.class) @RunWith(AndroidTestingRunner.class)
@TestableLooper.RunWithLooper @TestableLooper.RunWithLooper
@SmallTest @SmallTest
public class QSCarrierGroupControllerTest extends LeakCheckedTest { public class ShadeCarrierGroupControllerTest extends LeakCheckedTest {
private QSCarrierGroupController mQSCarrierGroupController; private ShadeCarrierGroupController mShadeCarrierGroupController;
private SignalCallback mSignalCallback; private SignalCallback mSignalCallback;
private CarrierTextManager.CarrierTextCallback mCallback; private CarrierTextManager.CarrierTextCallback mCallback;
@Mock @Mock
private QSCarrierGroup mQSCarrierGroup; private ShadeCarrierGroup mShadeCarrierGroup;
@Mock @Mock
private ActivityStarter mActivityStarter; private ActivityStarter mActivityStarter;
@Mock @Mock
@@ -81,14 +81,14 @@ public class QSCarrierGroupControllerTest extends LeakCheckedTest {
@Mock @Mock
private CarrierConfigTracker mCarrierConfigTracker; private CarrierConfigTracker mCarrierConfigTracker;
@Mock @Mock
private QSCarrier mQSCarrier1; private ShadeCarrier mShadeCarrier1;
@Mock @Mock
private QSCarrier mQSCarrier2; private ShadeCarrier mShadeCarrier2;
@Mock @Mock
private QSCarrier mQSCarrier3; private ShadeCarrier mShadeCarrier3;
private TestableLooper mTestableLooper; private TestableLooper mTestableLooper;
@Mock @Mock
private QSCarrierGroupController.OnSingleCarrierChangedListener mOnSingleCarrierChangedListener; private ShadeCarrierGroupController.OnSingleCarrierChangedListener mOnSingleCarrierChangedListener;
private FakeSlotIndexResolver mSlotIndexResolver; private FakeSlotIndexResolver mSlotIndexResolver;
private ClickListenerTextView mNoCarrierTextView; private ClickListenerTextView mNoCarrierTextView;
@@ -116,28 +116,28 @@ public class QSCarrierGroupControllerTest extends LeakCheckedTest {
.setListening(any(CarrierTextManager.CarrierTextCallback.class)); .setListening(any(CarrierTextManager.CarrierTextCallback.class));
mNoCarrierTextView = new ClickListenerTextView(mContext); mNoCarrierTextView = new ClickListenerTextView(mContext);
when(mQSCarrierGroup.getNoSimTextView()).thenReturn(mNoCarrierTextView); when(mShadeCarrierGroup.getNoSimTextView()).thenReturn(mNoCarrierTextView);
when(mQSCarrierGroup.getCarrier1View()).thenReturn(mQSCarrier1); when(mShadeCarrierGroup.getCarrier1View()).thenReturn(mShadeCarrier1);
when(mQSCarrierGroup.getCarrier2View()).thenReturn(mQSCarrier2); when(mShadeCarrierGroup.getCarrier2View()).thenReturn(mShadeCarrier2);
when(mQSCarrierGroup.getCarrier3View()).thenReturn(mQSCarrier3); when(mShadeCarrierGroup.getCarrier3View()).thenReturn(mShadeCarrier3);
when(mQSCarrierGroup.getCarrierDivider1()).thenReturn(new View(mContext)); when(mShadeCarrierGroup.getCarrierDivider1()).thenReturn(new View(mContext));
when(mQSCarrierGroup.getCarrierDivider2()).thenReturn(new View(mContext)); when(mShadeCarrierGroup.getCarrierDivider2()).thenReturn(new View(mContext));
mSlotIndexResolver = new FakeSlotIndexResolver(); mSlotIndexResolver = new FakeSlotIndexResolver();
mQSCarrierGroupController = new QSCarrierGroupController.Builder( mShadeCarrierGroupController = new ShadeCarrierGroupController.Builder(
mActivityStarter, handler, TestableLooper.get(this).getLooper(), mActivityStarter, handler, TestableLooper.get(this).getLooper(),
mNetworkController, mCarrierTextControllerBuilder, mContext, mCarrierConfigTracker, mNetworkController, mCarrierTextControllerBuilder, mContext, mCarrierConfigTracker,
mSlotIndexResolver) mSlotIndexResolver)
.setQSCarrierGroup(mQSCarrierGroup) .setShadeCarrierGroup(mShadeCarrierGroup)
.build(); .build();
mQSCarrierGroupController.setListening(true); mShadeCarrierGroupController.setListening(true);
} }
@Test @Test
public void testInitiallyMultiCarrier() { public void testInitiallyMultiCarrier() {
assertFalse(mQSCarrierGroupController.isSingleCarrier()); assertFalse(mShadeCarrierGroupController.isSingleCarrier());
} }
@Test // throws no Exception @Test // throws no Exception
@@ -257,12 +257,12 @@ public class QSCarrierGroupControllerTest extends LeakCheckedTest {
true /* airplaneMode */); true /* airplaneMode */);
mCallback.updateCarrierInfo(info); mCallback.updateCarrierInfo(info);
mTestableLooper.processAllMessages(); mTestableLooper.processAllMessages();
assertEquals(View.GONE, mQSCarrierGroup.getNoSimTextView().getVisibility()); assertEquals(View.GONE, mShadeCarrierGroup.getNoSimTextView().getVisibility());
} }
@Test @Test
public void testListenerNotCalledOnRegistreation() { public void testListenerNotCalledOnRegistreation() {
mQSCarrierGroupController mShadeCarrierGroupController
.setOnSingleCarrierChangedListener(mOnSingleCarrierChangedListener); .setOnSingleCarrierChangedListener(mOnSingleCarrierChangedListener);
verify(mOnSingleCarrierChangedListener, never()).onSingleCarrierChanged(anyBoolean()); verify(mOnSingleCarrierChangedListener, never()).onSingleCarrierChanged(anyBoolean());
@@ -282,9 +282,9 @@ public class QSCarrierGroupControllerTest extends LeakCheckedTest {
mCallback.updateCarrierInfo(info); mCallback.updateCarrierInfo(info);
mTestableLooper.processAllMessages(); mTestableLooper.processAllMessages();
verify(mQSCarrier1).updateState(any(), eq(true)); verify(mShadeCarrier1).updateState(any(), eq(true));
verify(mQSCarrier2).updateState(any(), eq(true)); verify(mShadeCarrier2).updateState(any(), eq(true));
verify(mQSCarrier3).updateState(any(), eq(true)); verify(mShadeCarrier3).updateState(any(), eq(true));
} }
@Test @Test
@@ -301,9 +301,9 @@ public class QSCarrierGroupControllerTest extends LeakCheckedTest {
mCallback.updateCarrierInfo(info); mCallback.updateCarrierInfo(info);
mTestableLooper.processAllMessages(); mTestableLooper.processAllMessages();
verify(mQSCarrier1).updateState(any(), eq(false)); verify(mShadeCarrier1).updateState(any(), eq(false));
verify(mQSCarrier2).updateState(any(), eq(false)); verify(mShadeCarrier2).updateState(any(), eq(false));
verify(mQSCarrier3).updateState(any(), eq(false)); verify(mShadeCarrier3).updateState(any(), eq(false));
} }
@Test @Test
@@ -327,7 +327,7 @@ public class QSCarrierGroupControllerTest extends LeakCheckedTest {
mCallback.updateCarrierInfo(singleCarrierInfo); mCallback.updateCarrierInfo(singleCarrierInfo);
mTestableLooper.processAllMessages(); mTestableLooper.processAllMessages();
mQSCarrierGroupController mShadeCarrierGroupController
.setOnSingleCarrierChangedListener(mOnSingleCarrierChangedListener); .setOnSingleCarrierChangedListener(mOnSingleCarrierChangedListener);
reset(mOnSingleCarrierChangedListener); reset(mOnSingleCarrierChangedListener);
@@ -353,7 +353,7 @@ public class QSCarrierGroupControllerTest extends LeakCheckedTest {
mCallback.updateCarrierInfo(singleCarrierInfo); mCallback.updateCarrierInfo(singleCarrierInfo);
mTestableLooper.processAllMessages(); mTestableLooper.processAllMessages();
mQSCarrierGroupController mShadeCarrierGroupController
.setOnSingleCarrierChangedListener(mOnSingleCarrierChangedListener); .setOnSingleCarrierChangedListener(mOnSingleCarrierChangedListener);
mCallback.updateCarrierInfo(singleCarrierInfo); mCallback.updateCarrierInfo(singleCarrierInfo);
@@ -375,7 +375,7 @@ public class QSCarrierGroupControllerTest extends LeakCheckedTest {
mCallback.updateCarrierInfo(multiCarrierInfo); mCallback.updateCarrierInfo(multiCarrierInfo);
mTestableLooper.processAllMessages(); mTestableLooper.processAllMessages();
mQSCarrierGroupController mShadeCarrierGroupController
.setOnSingleCarrierChangedListener(mOnSingleCarrierChangedListener); .setOnSingleCarrierChangedListener(mOnSingleCarrierChangedListener);
mCallback.updateCarrierInfo(multiCarrierInfo); mCallback.updateCarrierInfo(multiCarrierInfo);
@@ -389,12 +389,12 @@ public class QSCarrierGroupControllerTest extends LeakCheckedTest {
ArgumentCaptor<View.OnClickListener> captor = ArgumentCaptor<View.OnClickListener> captor =
ArgumentCaptor.forClass(View.OnClickListener.class); ArgumentCaptor.forClass(View.OnClickListener.class);
verify(mQSCarrier1).setOnClickListener(captor.capture()); verify(mShadeCarrier1).setOnClickListener(captor.capture());
verify(mQSCarrier2).setOnClickListener(captor.getValue()); verify(mShadeCarrier2).setOnClickListener(captor.getValue());
verify(mQSCarrier3).setOnClickListener(captor.getValue()); verify(mShadeCarrier3).setOnClickListener(captor.getValue());
assertThat(mNoCarrierTextView.getOnClickListener()).isSameInstanceAs(captor.getValue()); assertThat(mNoCarrierTextView.getOnClickListener()).isSameInstanceAs(captor.getValue());
verify(mQSCarrierGroup, never()).setOnClickListener(any()); verify(mShadeCarrierGroup, never()).setOnClickListener(any());
} }
@Test @Test
@@ -402,10 +402,10 @@ public class QSCarrierGroupControllerTest extends LeakCheckedTest {
ArgumentCaptor<View.OnClickListener> captor = ArgumentCaptor<View.OnClickListener> captor =
ArgumentCaptor.forClass(View.OnClickListener.class); ArgumentCaptor.forClass(View.OnClickListener.class);
verify(mQSCarrier1).setOnClickListener(captor.capture()); verify(mShadeCarrier1).setOnClickListener(captor.capture());
when(mQSCarrier1.isVisibleToUser()).thenReturn(false); when(mShadeCarrier1.isVisibleToUser()).thenReturn(false);
captor.getValue().onClick(mQSCarrier1); captor.getValue().onClick(mShadeCarrier1);
verifyZeroInteractions(mActivityStarter); verifyZeroInteractions(mActivityStarter);
} }
@@ -415,17 +415,17 @@ public class QSCarrierGroupControllerTest extends LeakCheckedTest {
ArgumentCaptor.forClass(View.OnClickListener.class); ArgumentCaptor.forClass(View.OnClickListener.class);
ArgumentCaptor<Intent> intentCaptor = ArgumentCaptor.forClass(Intent.class); ArgumentCaptor<Intent> intentCaptor = ArgumentCaptor.forClass(Intent.class);
verify(mQSCarrier1).setOnClickListener(listenerCaptor.capture()); verify(mShadeCarrier1).setOnClickListener(listenerCaptor.capture());
when(mQSCarrier1.isVisibleToUser()).thenReturn(true); when(mShadeCarrier1.isVisibleToUser()).thenReturn(true);
listenerCaptor.getValue().onClick(mQSCarrier1); listenerCaptor.getValue().onClick(mShadeCarrier1);
verify(mActivityStarter) verify(mActivityStarter)
.postStartActivityDismissingKeyguard(intentCaptor.capture(), anyInt()); .postStartActivityDismissingKeyguard(intentCaptor.capture(), anyInt());
assertThat(intentCaptor.getValue().getAction()) assertThat(intentCaptor.getValue().getAction())
.isEqualTo(Settings.ACTION_WIRELESS_SETTINGS); .isEqualTo(Settings.ACTION_WIRELESS_SETTINGS);
} }
private class FakeSlotIndexResolver implements QSCarrierGroupController.SlotIndexResolver { private class FakeSlotIndexResolver implements ShadeCarrierGroupController.SlotIndexResolver {
public boolean overrideInvalid; public boolean overrideInvalid;
@Override @Override

View File

@@ -1,11 +1,11 @@
/* /*
* Copyright (C) 2020 The Android Open Source Project * Copyright (C) 2023 The Android Open Source Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.systemui.qs.carrier; package com.android.systemui.shade.carrier;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
@@ -39,9 +39,9 @@ import org.junit.runner.RunWith;
@RunWith(AndroidTestingRunner.class) @RunWith(AndroidTestingRunner.class)
@TestableLooper.RunWithLooper @TestableLooper.RunWithLooper
@SmallTest @SmallTest
public class QSCarrierTest extends SysuiTestCase { public class ShadeCarrierTest extends SysuiTestCase {
private QSCarrier mQSCarrier; private ShadeCarrier mShadeCarrier;
private TestableLooper mTestableLooper; private TestableLooper mTestableLooper;
private int mSignalIconId; private int mSignalIconId;
@@ -51,7 +51,7 @@ public class QSCarrierTest extends SysuiTestCase {
LayoutInflater inflater = LayoutInflater.from(mContext); LayoutInflater inflater = LayoutInflater.from(mContext);
mContext.ensureTestableResources(); mContext.ensureTestableResources();
mTestableLooper.runWithLooper(() -> mTestableLooper.runWithLooper(() ->
mQSCarrier = (QSCarrier) inflater.inflate(R.layout.qs_carrier, null)); mShadeCarrier = (ShadeCarrier) inflater.inflate(R.layout.shade_carrier, null));
// In this case, the id is an actual drawable id // In this case, the id is an actual drawable id
mSignalIconId = TelephonyIcons.MOBILE_CALL_STRENGTH_ICONS[0]; mSignalIconId = TelephonyIcons.MOBILE_CALL_STRENGTH_ICONS[0];
@@ -61,76 +61,76 @@ public class QSCarrierTest extends SysuiTestCase {
public void testUpdateState_first() { public void testUpdateState_first() {
CellSignalState c = new CellSignalState(true, mSignalIconId, "", "", false); CellSignalState c = new CellSignalState(true, mSignalIconId, "", "", false);
assertTrue(mQSCarrier.updateState(c, false)); assertTrue(mShadeCarrier.updateState(c, false));
} }
@Test @Test
public void testUpdateState_same() { public void testUpdateState_same() {
CellSignalState c = new CellSignalState(true, mSignalIconId, "", "", false); CellSignalState c = new CellSignalState(true, mSignalIconId, "", "", false);
assertTrue(mQSCarrier.updateState(c, false)); assertTrue(mShadeCarrier.updateState(c, false));
assertFalse(mQSCarrier.updateState(c, false)); assertFalse(mShadeCarrier.updateState(c, false));
} }
@Test @Test
public void testUpdateState_changed() { public void testUpdateState_changed() {
CellSignalState c = new CellSignalState(true, mSignalIconId, "", "", false); CellSignalState c = new CellSignalState(true, mSignalIconId, "", "", false);
assertTrue(mQSCarrier.updateState(c, false)); assertTrue(mShadeCarrier.updateState(c, false));
CellSignalState other = c.changeVisibility(false); CellSignalState other = c.changeVisibility(false);
assertTrue(mQSCarrier.updateState(other, false)); assertTrue(mShadeCarrier.updateState(other, false));
} }
@Test @Test
public void testUpdateState_singleCarrier_first() { public void testUpdateState_singleCarrier_first() {
CellSignalState c = new CellSignalState(true, mSignalIconId, "", "", false); CellSignalState c = new CellSignalState(true, mSignalIconId, "", "", false);
assertTrue(mQSCarrier.updateState(c, true)); assertTrue(mShadeCarrier.updateState(c, true));
} }
@Test @Test
public void testUpdateState_singleCarrier_noShowIcon() { public void testUpdateState_singleCarrier_noShowIcon() {
CellSignalState c = new CellSignalState(true, mSignalIconId, "", "", false); CellSignalState c = new CellSignalState(true, mSignalIconId, "", "", false);
mQSCarrier.updateState(c, true); mShadeCarrier.updateState(c, true);
assertEquals(View.GONE, mQSCarrier.getRSSIView().getVisibility()); assertEquals(View.GONE, mShadeCarrier.getRSSIView().getVisibility());
} }
@Test @Test
public void testUpdateState_multiCarrier_showIcon() { public void testUpdateState_multiCarrier_showIcon() {
CellSignalState c = new CellSignalState(true, mSignalIconId, "", "", false); CellSignalState c = new CellSignalState(true, mSignalIconId, "", "", false);
mQSCarrier.updateState(c, false); mShadeCarrier.updateState(c, false);
assertEquals(View.VISIBLE, mQSCarrier.getRSSIView().getVisibility()); assertEquals(View.VISIBLE, mShadeCarrier.getRSSIView().getVisibility());
} }
@Test @Test
public void testUpdateState_changeSingleMultiSingle() { public void testUpdateState_changeSingleMultiSingle() {
CellSignalState c = new CellSignalState(true, mSignalIconId, "", "", false); CellSignalState c = new CellSignalState(true, mSignalIconId, "", "", false);
mQSCarrier.updateState(c, true); mShadeCarrier.updateState(c, true);
assertEquals(View.GONE, mQSCarrier.getRSSIView().getVisibility()); assertEquals(View.GONE, mShadeCarrier.getRSSIView().getVisibility());
mQSCarrier.updateState(c, false); mShadeCarrier.updateState(c, false);
assertEquals(View.VISIBLE, mQSCarrier.getRSSIView().getVisibility()); assertEquals(View.VISIBLE, mShadeCarrier.getRSSIView().getVisibility());
mQSCarrier.updateState(c, true); mShadeCarrier.updateState(c, true);
assertEquals(View.GONE, mQSCarrier.getRSSIView().getVisibility()); assertEquals(View.GONE, mShadeCarrier.getRSSIView().getVisibility());
} }
@Test @Test
public void testCarrierNameMaxWidth_smallScreen_fromResource() { public void testCarrierNameMaxWidth_smallScreen_fromResource() {
int maxEms = 10; int maxEms = 10;
mContext.getOrCreateTestableResources().addOverride(R.integer.qs_carrier_max_em, maxEms); mContext.getOrCreateTestableResources().addOverride(R.integer.shade_carrier_max_em, maxEms);
mContext.getOrCreateTestableResources() mContext.getOrCreateTestableResources()
.addOverride(R.bool.config_use_large_screen_shade_header, false); .addOverride(R.bool.config_use_large_screen_shade_header, false);
TextView carrierText = mQSCarrier.requireViewById(R.id.qs_carrier_text); TextView carrierText = mShadeCarrier.requireViewById(R.id.shade_carrier_text);
mQSCarrier.onConfigurationChanged(mContext.getResources().getConfiguration()); mShadeCarrier.onConfigurationChanged(mContext.getResources().getConfiguration());
assertEquals(maxEms, carrierText.getMaxEms()); assertEquals(maxEms, carrierText.getMaxEms());
} }
@@ -138,12 +138,12 @@ public class QSCarrierTest extends SysuiTestCase {
@Test @Test
public void testCarrierNameMaxWidth_largeScreen_maxInt() { public void testCarrierNameMaxWidth_largeScreen_maxInt() {
int maxEms = 10; int maxEms = 10;
mContext.getOrCreateTestableResources().addOverride(R.integer.qs_carrier_max_em, maxEms); mContext.getOrCreateTestableResources().addOverride(R.integer.shade_carrier_max_em, maxEms);
mContext.getOrCreateTestableResources() mContext.getOrCreateTestableResources()
.addOverride(R.bool.config_use_large_screen_shade_header, true); .addOverride(R.bool.config_use_large_screen_shade_header, true);
TextView carrierText = mQSCarrier.requireViewById(R.id.qs_carrier_text); TextView carrierText = mShadeCarrier.requireViewById(R.id.shade_carrier_text);
mQSCarrier.onConfigurationChanged(mContext.getResources().getConfiguration()); mShadeCarrier.onConfigurationChanged(mContext.getResources().getConfiguration());
assertEquals(Integer.MAX_VALUE, carrierText.getMaxEms()); assertEquals(Integer.MAX_VALUE, carrierText.getMaxEms());
} }