SysUI Demo Mode: Ensure we have plenty of sims.
And update some docs. Bug: 21157785 Change-Id: I8e44e160377e66f15c6348a87326998c98cea787
This commit is contained in:
@@ -38,6 +38,8 @@ Command | Subcommand | Argument | Description
|
||||
| | ```datatype``` | Values: ```1x```, ```3g```, ```4g```, ```e```, ```g```, ```h```, ```lte```, ```roam```, any other value to hide
|
||||
| | ```level``` | Sets mobile signal strength level (null or 0-4)
|
||||
| ```carriernetworkchange``` | | Sets mobile signal icon to carrier network change UX when disconnected (```show``` to show icon, any other value to hide)
|
||||
| ```sims``` | | Sets the number of sims (1-8)
|
||||
| ```nosim``` | | ```show``` to show icon, any other value to hide
|
||||
```bars``` | | | Control the visual style of the bars (opaque, translucent, etc)
|
||||
| ```mode``` | | Sets the bars visual style (opaque, translucent, semi-transparent)
|
||||
```status``` | | | Control the system status icons
|
||||
|
||||
@@ -36,6 +36,7 @@ import android.telephony.SubscriptionManager.OnSubscriptionsChangedListener;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.util.MathUtils;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.telephony.PhoneConstants;
|
||||
@@ -99,14 +100,12 @@ public class NetworkControllerImpl extends BroadcastReceiver
|
||||
private boolean mHasNoSims;
|
||||
private Locale mLocale = null;
|
||||
// This list holds our ordering.
|
||||
private List<SubscriptionInfo> mCurrentSubscriptions
|
||||
= new ArrayList<SubscriptionInfo>();
|
||||
private List<SubscriptionInfo> mCurrentSubscriptions = new ArrayList<>();
|
||||
|
||||
// All the callbacks.
|
||||
private ArrayList<EmergencyListener> mEmergencyListeners = new ArrayList<EmergencyListener>();
|
||||
private ArrayList<SignalCluster> mSignalClusters = new ArrayList<SignalCluster>();
|
||||
private ArrayList<NetworkSignalChangedCallback> mSignalsChangedCallbacks =
|
||||
new ArrayList<NetworkSignalChangedCallback>();
|
||||
private ArrayList<EmergencyListener> mEmergencyListeners = new ArrayList<>();
|
||||
private ArrayList<SignalCluster> mSignalClusters = new ArrayList<>();
|
||||
private ArrayList<NetworkSignalChangedCallback> mSignalsChangedCallbacks = new ArrayList<>();
|
||||
@VisibleForTesting
|
||||
boolean mListening;
|
||||
|
||||
@@ -664,18 +663,13 @@ public class NetworkControllerImpl extends BroadcastReceiver
|
||||
}
|
||||
String sims = args.getString("sims");
|
||||
if (sims != null) {
|
||||
int num = Integer.parseInt(sims);
|
||||
List<SubscriptionInfo> subs = new ArrayList<SubscriptionInfo>();
|
||||
int num = MathUtils.constrain(Integer.parseInt(sims), 1, 8);
|
||||
List<SubscriptionInfo> subs = new ArrayList<>();
|
||||
if (num != mMobileSignalControllers.size()) {
|
||||
mMobileSignalControllers.clear();
|
||||
int start = mSubscriptionManager.getActiveSubscriptionInfoCountMax();
|
||||
for (int i = start /* get out of normal index range */; i < start + num; i++) {
|
||||
SubscriptionInfo info = new SubscriptionInfo(i, "", i, "", "", 0, 0, "", 0,
|
||||
null, 0, 0, "");
|
||||
subs.add(info);
|
||||
mMobileSignalControllers.put(i, new MobileSignalController(mContext,
|
||||
mConfig, mHasMobileDataFeature, mPhone, mSignalsChangedCallbacks,
|
||||
mSignalClusters, this, info));
|
||||
subs.add(addSignalController(i, i));
|
||||
}
|
||||
}
|
||||
final int n = mSignalClusters.size();
|
||||
@@ -697,6 +691,19 @@ public class NetworkControllerImpl extends BroadcastReceiver
|
||||
String datatype = args.getString("datatype");
|
||||
String slotString = args.getString("slot");
|
||||
int slot = TextUtils.isEmpty(slotString) ? 0 : Integer.parseInt(slotString);
|
||||
slot = MathUtils.constrain(slot, 0, 8);
|
||||
// Ensure we have enough sim slots
|
||||
List<SubscriptionInfo> subs = new ArrayList<>();
|
||||
while (mMobileSignalControllers.size() <= slot) {
|
||||
int nextSlot = mMobileSignalControllers.size();
|
||||
subs.add(addSignalController(nextSlot, nextSlot));
|
||||
}
|
||||
if (!subs.isEmpty()) {
|
||||
final int n = mSignalClusters.size();
|
||||
for (int i = 0; i < n; i++) {
|
||||
mSignalClusters.get(i).setSubs(subs);
|
||||
}
|
||||
}
|
||||
// Hack to index linearly for easy use.
|
||||
MobileSignalController controller = mMobileSignalControllers
|
||||
.values().toArray(new MobileSignalController[0])[slot];
|
||||
@@ -733,6 +740,15 @@ public class NetworkControllerImpl extends BroadcastReceiver
|
||||
}
|
||||
}
|
||||
|
||||
private SubscriptionInfo addSignalController(int id, int simSlotIndex) {
|
||||
SubscriptionInfo info = new SubscriptionInfo(id, "", simSlotIndex, "", "", 0, 0, "", 0,
|
||||
null, 0, 0, "");
|
||||
mMobileSignalControllers.put(id, new MobileSignalController(mContext,
|
||||
mConfig, mHasMobileDataFeature, mPhone, mSignalsChangedCallbacks,
|
||||
mSignalClusters, this, info));
|
||||
return info;
|
||||
}
|
||||
|
||||
private final OnSubscriptionsChangedListener mSubscriptionListener =
|
||||
new OnSubscriptionsChangedListener() {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user