Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
Merge changes from topic "revert-19436880-revert-19279477-UFVLVIEMJU-…
Browse files Browse the repository at this point in the history
…NPEBAMHHJM" into tm-qpr-dev

* changes:
  Remove remaining references to COMBINED_STATUS_BAR_SIGNAL_FLAGS
  Revert^2 "Remove support for COMBINED_SIGNAL_ICONS"
  Revert^2 "Create a MobileStatusTrackerFactory"
  Revert^2 "Change from deprecated telephony api"
  Revert^2 "[Cleanup] Order NetworkController's intent filters"
  Revert^2 "Add an @Inject-able MobileSignalControllerFactory"
  • Loading branch information
Evan Laird authored and Android (Google) Code Review committed Aug 4, 2022
2 parents 9f8a5c0 + 36928c0 commit 1e8d802
Show file tree
Hide file tree
Showing 25 changed files with 241 additions and 643 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ public class MobileStatusTracker {
private final Handler mReceiverHandler;
private final MobileTelephonyCallback mTelephonyCallback;

private boolean mListening = false;

/**
* MobileStatusTracker constructors
*
Expand Down Expand Up @@ -76,13 +78,18 @@ public MobileTelephonyCallback getTelephonyCallback() {
* Config the MobileStatusTracker to start or stop monitoring platform signals.
*/
public void setListening(boolean listening) {
mListening = listening;
if (listening) {
mPhone.registerTelephonyCallback(mReceiverHandler::post, mTelephonyCallback);
} else {
mPhone.unregisterTelephonyCallback(mTelephonyCallback);
}
}

public boolean isListening() {
return mListening;
}

private void updateDataSim() {
int activeDataSubId = mDefaults.getActiveDataSubId();
if (SubscriptionManager.isValidSubscriptionId(activeDataSubId)) {
Expand Down
3 changes: 0 additions & 3 deletions packages/SystemUI/src/com/android/systemui/flags/Flags.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,6 @@ public class Flags {

/***************************************/
// 600- status bar
public static final BooleanFlag COMBINED_STATUS_BAR_SIGNAL_ICONS =
new BooleanFlag(601, false);

public static final ResourceBooleanFlag STATUS_BAR_USER_SWITCHER =
new ResourceBooleanFlag(602, R.bool.flag_user_switcher_chip);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,18 +134,9 @@ protected void onViewAttached() {
mQSCarrierGroupController
.setOnSingleCarrierChangedListener(mView::setIsSingleCarrier);

List<String> rssiIgnoredSlots;

if (mFeatureFlags.isEnabled(Flags.COMBINED_STATUS_BAR_SIGNAL_ICONS)) {
rssiIgnoredSlots = List.of(
getResources().getString(com.android.internal.R.string.status_bar_no_calling),
getResources().getString(com.android.internal.R.string.status_bar_call_strength)
);
} else {
rssiIgnoredSlots = List.of(
getResources().getString(com.android.internal.R.string.status_bar_mobile)
);
}
List<String> rssiIgnoredSlots = List.of(
getResources().getString(com.android.internal.R.string.status_bar_mobile)
);

mView.onAttach(mIconManager, mQSExpansionPathInterpolator, rssiIgnoredSlots,
mInsetsProvider, mFeatureFlags.isEnabled(Flags.COMBINED_QS_HEADERS));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ data class CellSignalState(
@JvmField val contentDescription: String? = null,
@JvmField val typeContentDescription: String? = null,
@JvmField val roaming: Boolean = false,
@JvmField val providerModelBehavior: Boolean = false
) {
/**
* Changes the visibility of this state by returning a copy with the visibility changed.
Expand All @@ -41,4 +40,4 @@ data class CellSignalState(
if (this.visible == visible) return this
else return copy(visible = visible)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class QSCarrier extends LinearLayout {
private View mSpacer;
@Nullable
private CellSignalState mLastSignalState;
private boolean mProviderModelInitialized = false;
private boolean mMobileSignalInitialized = false;
private boolean mIsSingleCarrier;

public QSCarrier(Context context) {
Expand Down Expand Up @@ -96,35 +96,25 @@ public boolean updateState(CellSignalState state, boolean isSingleCarrier) {
mMobileRoaming.setImageTintList(colorStateList);
mMobileSignal.setImageTintList(colorStateList);

if (state.providerModelBehavior) {
if (!mProviderModelInitialized) {
mProviderModelInitialized = true;
mMobileSignal.setImageDrawable(
mContext.getDrawable(R.drawable.ic_qs_no_calling_sms));
}
mMobileSignal.setImageDrawable(mContext.getDrawable(state.mobileSignalIconId));
mMobileSignal.setContentDescription(state.contentDescription);
} else {
if (!mProviderModelInitialized) {
mProviderModelInitialized = true;
mMobileSignal.setImageDrawable(new SignalDrawable(mContext));
}
mMobileSignal.setImageLevel(state.mobileSignalIconId);
StringBuilder contentDescription = new StringBuilder();
if (state.contentDescription != null) {
contentDescription.append(state.contentDescription).append(", ");
}
if (state.roaming) {
contentDescription
.append(mContext.getString(R.string.data_connection_roaming))
.append(", ");
}
// TODO: show mobile data off/no internet text for 5 seconds before carrier text
if (hasValidTypeContentDescription(state.typeContentDescription)) {
contentDescription.append(state.typeContentDescription);
}
mMobileSignal.setContentDescription(contentDescription);
if (!mMobileSignalInitialized) {
mMobileSignalInitialized = true;
mMobileSignal.setImageDrawable(new SignalDrawable(mContext));
}
mMobileSignal.setImageLevel(state.mobileSignalIconId);
StringBuilder contentDescription = new StringBuilder();
if (state.contentDescription != null) {
contentDescription.append(state.contentDescription).append(", ");
}
if (state.roaming) {
contentDescription
.append(mContext.getString(R.string.data_connection_roaming))
.append(", ");
}
// TODO: show mobile data off/no internet text for 5 seconds before carrier text
if (hasValidTypeContentDescription(state.typeContentDescription)) {
contentDescription.append(state.typeContentDescription);
}
mMobileSignal.setContentDescription(contentDescription);
}
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dagger.qualifiers.Background;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.flags.FeatureFlags;
import com.android.systemui.flags.Flags;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.statusbar.connectivity.IconState;
import com.android.systemui.statusbar.connectivity.MobileDataIndicators;
import com.android.systemui.statusbar.connectivity.NetworkController;
import com.android.systemui.statusbar.connectivity.SignalCallback;
Expand Down Expand Up @@ -78,7 +75,6 @@ public class QSCarrierGroupController {
private QSCarrier[] mCarrierGroups = new QSCarrier[SIM_SLOTS];
private int[] mLastSignalLevel = new int[SIM_SLOTS];
private String[] mLastSignalLevelDescription = new String[SIM_SLOTS];
private final boolean mProviderModel;
private final CarrierConfigTracker mCarrierConfigTracker;

private boolean mIsSingleCarrier;
Expand All @@ -90,9 +86,6 @@ public class QSCarrierGroupController {
private final SignalCallback mSignalCallback = new SignalCallback() {
@Override
public void setMobileDataIndicators(@NonNull MobileDataIndicators indicators) {
if (mProviderModel) {
return;
}
int slotIndex = getSlotIndex(indicators.subId);
if (slotIndex >= SIM_SLOTS) {
Log.w(TAG, "setMobileDataIndicators - slot: " + slotIndex);
Expand All @@ -107,90 +100,11 @@ public void setMobileDataIndicators(@NonNull MobileDataIndicators indicators) {
indicators.statusIcon.icon,
indicators.statusIcon.contentDescription,
indicators.typeContentDescription.toString(),
indicators.roaming,
mProviderModel
indicators.roaming
);
mMainHandler.obtainMessage(H.MSG_UPDATE_STATE).sendToTarget();
}

@Override
public void setCallIndicator(@NonNull IconState statusIcon, int subId) {
if (!mProviderModel) {
return;
}
int slotIndex = getSlotIndex(subId);
if (slotIndex >= SIM_SLOTS) {
Log.w(TAG, "setMobileDataIndicators - slot: " + slotIndex);
return;
}
if (slotIndex == SubscriptionManager.INVALID_SIM_SLOT_INDEX) {
Log.e(TAG, "Invalid SIM slot index for subscription: " + subId);
return;
}

boolean displayCallStrengthIcon =
mCarrierConfigTracker.getCallStrengthConfig(subId);

if (statusIcon.icon == R.drawable.ic_qs_no_calling_sms) {
if (statusIcon.visible) {
mInfos[slotIndex] = new CellSignalState(
true,
statusIcon.icon,
statusIcon.contentDescription,
"",
false,
mProviderModel);
} else {
// Whenever the no Calling & SMS state is cleared, switched to the last
// known call strength icon.
if (displayCallStrengthIcon) {
mInfos[slotIndex] = new CellSignalState(
true,
mLastSignalLevel[slotIndex],
mLastSignalLevelDescription[slotIndex],
"",
false,
mProviderModel);
} else {
mInfos[slotIndex] = new CellSignalState(
true,
R.drawable.ic_qs_sim_card,
"",
"",
false,
mProviderModel);
}
}
mMainHandler.obtainMessage(H.MSG_UPDATE_STATE).sendToTarget();
} else {
mLastSignalLevel[slotIndex] = statusIcon.icon;
mLastSignalLevelDescription[slotIndex] = statusIcon.contentDescription;
// Only Shows the call strength icon when the no Calling & SMS icon is not
// shown.
if (mInfos[slotIndex].mobileSignalIconId
!= R.drawable.ic_qs_no_calling_sms) {
if (displayCallStrengthIcon) {
mInfos[slotIndex] = new CellSignalState(
true,
statusIcon.icon,
statusIcon.contentDescription,
"",
false,
mProviderModel);
} else {
mInfos[slotIndex] = new CellSignalState(
true,
R.drawable.ic_qs_sim_card,
"",
"",
false,
mProviderModel);
}
mMainHandler.obtainMessage(H.MSG_UPDATE_STATE).sendToTarget();
}
}
}

@Override
public void setNoSims(boolean hasNoSims, boolean simDetected) {
if (hasNoSims) {
Expand Down Expand Up @@ -219,14 +133,8 @@ private QSCarrierGroupController(QSCarrierGroup view, ActivityStarter activitySt
@Background Handler bgHandler, @Main Looper mainLooper,
NetworkController networkController,
CarrierTextManager.Builder carrierTextManagerBuilder, Context context,
CarrierConfigTracker carrierConfigTracker, FeatureFlags featureFlags,
SlotIndexResolver slotIndexResolver) {
CarrierConfigTracker carrierConfigTracker, SlotIndexResolver slotIndexResolver) {

if (featureFlags.isEnabled(Flags.COMBINED_STATUS_BAR_SIGNAL_ICONS)) {
mProviderModel = true;
} else {
mProviderModel = false;
}
mActivityStarter = activityStarter;
mBgHandler = bgHandler;
mNetworkController = networkController;
Expand Down Expand Up @@ -262,8 +170,7 @@ private QSCarrierGroupController(QSCarrierGroup view, ActivityStarter activitySt
R.drawable.ic_qs_no_calling_sms,
context.getText(AccessibilityContentDescriptions.NO_CALLING).toString(),
"",
false,
mProviderModel);
false);
mLastSignalLevel[i] = TelephonyIcons.MOBILE_CALL_STRENGTH_ICONS[0];
mLastSignalLevelDescription[i] =
context.getText(AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0])
Expand Down Expand Up @@ -351,8 +258,7 @@ private void handleUpdateState() {
for (int i = 0; i < SIM_SLOTS; i++) {
if (mInfos[i].visible
&& mInfos[i].mobileSignalIconId == R.drawable.ic_qs_sim_card) {
mInfos[i] = new CellSignalState(true, R.drawable.ic_blank, "", "", false,
mProviderModel);
mInfos[i] = new CellSignalState(true, R.drawable.ic_blank, "", "", false);
}
}
}
Expand Down Expand Up @@ -470,23 +376,20 @@ public static class Builder {
private final CarrierTextManager.Builder mCarrierTextControllerBuilder;
private final Context mContext;
private final CarrierConfigTracker mCarrierConfigTracker;
private final FeatureFlags mFeatureFlags;
private final SlotIndexResolver mSlotIndexResolver;

@Inject
public Builder(ActivityStarter activityStarter, @Background Handler handler,
@Main Looper looper, NetworkController networkController,
CarrierTextManager.Builder carrierTextControllerBuilder, Context context,
CarrierConfigTracker carrierConfigTracker, FeatureFlags featureFlags,
SlotIndexResolver slotIndexResolver) {
CarrierConfigTracker carrierConfigTracker, SlotIndexResolver slotIndexResolver) {
mActivityStarter = activityStarter;
mHandler = handler;
mLooper = looper;
mNetworkController = networkController;
mCarrierTextControllerBuilder = carrierTextControllerBuilder;
mContext = context;
mCarrierConfigTracker = carrierConfigTracker;
mFeatureFlags = featureFlags;
mSlotIndexResolver = slotIndexResolver;
}

Expand All @@ -498,7 +401,7 @@ public Builder setQSCarrierGroup(QSCarrierGroup view) {
public QSCarrierGroupController build() {
return new QSCarrierGroupController(mView, mActivityStarter, mHandler, mLooper,
mNetworkController, mCarrierTextControllerBuilder, mContext,
mCarrierConfigTracker, mFeatureFlags, mSlotIndexResolver);
mCarrierConfigTracker, mSlotIndexResolver);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,8 @@ void setMobileDataEnabled(Context context, int subId, boolean enabled,
return;
}

mTelephonyManager.setDataEnabled(enabled);
mTelephonyManager.setDataEnabledForReason(
TelephonyManager.DATA_ENABLED_REASON_USER, enabled);
if (disableOtherSubscriptions) {
final List<SubscriptionInfo> subInfoList =
mSubscriptionManager.getActiveSubscriptionInfoList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,14 +264,8 @@ class LargeScreenShadeHeaderController @Inject constructor(
Utils.getColorAttrDefaultColor(header.context, android.R.attr.textColorPrimary)
)

carrierIconSlots = if (featureFlags.isEnabled(Flags.COMBINED_STATUS_BAR_SIGNAL_ICONS)) {
listOf(
header.context.getString(com.android.internal.R.string.status_bar_no_calling),
header.context.getString(com.android.internal.R.string.status_bar_call_strength)
)
} else {
carrierIconSlots =
listOf(header.context.getString(com.android.internal.R.string.status_bar_mobile))
}
qsCarrierGroupController = qsCarrierGroupControllerBuilder
.setQSCarrierGroup(qsCarrierGroup)
.build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,19 @@ public class StatusBarMobileView extends FrameLayout implements DarkReceiver,
private int mVisibleState = -1;
private DualToneHandler mDualToneHandler;
private boolean mForceHidden;
private boolean mProviderModel;

/**
* Designated constructor
*/
public static StatusBarMobileView fromContext(
Context context,
String slot,
boolean providerModel
String slot
) {
LayoutInflater inflater = LayoutInflater.from(context);
StatusBarMobileView v = (StatusBarMobileView)
inflater.inflate(R.layout.status_bar_mobile_signal_group, null);
v.setSlot(slot);
v.init(providerModel);
v.init();
v.setVisibleState(STATE_ICON);
return v;
}
Expand Down Expand Up @@ -108,17 +106,12 @@ public void getDrawingRect(Rect outRect) {
outRect.bottom += translationY;
}

private void init(boolean providerModel) {
mProviderModel = providerModel;
private void init() {
mDualToneHandler = new DualToneHandler(getContext());
mMobileGroup = findViewById(R.id.mobile_group);
mMobile = findViewById(R.id.mobile_signal);
mMobileType = findViewById(R.id.mobile_type);
if (mProviderModel) {
mMobileRoaming = findViewById(R.id.mobile_roaming_large);
} else {
mMobileRoaming = findViewById(R.id.mobile_roaming);
}
mMobileRoaming = findViewById(R.id.mobile_roaming);
mMobileRoamingSpace = findViewById(R.id.mobile_roaming_space);
mIn = findViewById(R.id.mobile_in);
mOut = findViewById(R.id.mobile_out);
Expand Down
Loading

0 comments on commit 1e8d802

Please sign in to comment.