Merge "Fix some demo mode issues" into mnc-dev

This commit is contained in:
Jason Monk
2015-06-18 19:32:02 +00:00
committed by Android (Google) Code Review
3 changed files with 12 additions and 6 deletions

View File

@@ -124,6 +124,9 @@ public class DemoStatusIcons extends LinearLayout implements DemoMode {
private void updateSlot(String slot, String iconPkg, int iconId) { private void updateSlot(String slot, String iconPkg, int iconId) {
if (!mDemoMode) return; if (!mDemoMode) return;
if (iconPkg == null) {
iconPkg = mContext.getPackageName();
}
int removeIndex = -1; int removeIndex = -1;
for (int i = 0; i < getChildCount(); i++) { for (int i = 0; i < getChildCount(); i++) {
StatusBarIconView v = (StatusBarIconView) getChildAt(i); StatusBarIconView v = (StatusBarIconView) getChildAt(i);
@@ -143,10 +146,10 @@ public class DemoStatusIcons extends LinearLayout implements DemoMode {
if (iconId == 0) { if (iconId == 0) {
if (removeIndex != -1) { if (removeIndex != -1) {
removeViewAt(removeIndex); removeViewAt(removeIndex);
return;
} }
return;
} }
StatusBarIcon icon = new StatusBarIcon(iconPkg, UserHandle.CURRENT, iconId, 0, 0, "Demo"); StatusBarIcon icon = new StatusBarIcon(iconPkg, UserHandle.OWNER, iconId, 0, 0, "Demo");
StatusBarIconView v = new StatusBarIconView(getContext(), null, null); StatusBarIconView v = new StatusBarIconView(getContext(), null, null);
v.setTag(slot); v.setTag(slot);
v.set(icon); v.set(icon);

View File

@@ -408,7 +408,7 @@ public class NetworkControllerImpl extends BroadcastReceiver
boolean hasNoSims = mHasMobileDataFeature && mMobileSignalControllers.size() == 0; boolean hasNoSims = mHasMobileDataFeature && mMobileSignalControllers.size() == 0;
if (hasNoSims != mHasNoSims) { if (hasNoSims != mHasNoSims) {
mHasNoSims = hasNoSims; mHasNoSims = hasNoSims;
notifyListeners(); mCallbackHandler.setNoSims(mHasNoSims);
} }
} }
@@ -660,8 +660,8 @@ public class NetworkControllerImpl extends BroadcastReceiver
} }
String nosim = args.getString("nosim"); String nosim = args.getString("nosim");
if (nosim != null) { if (nosim != null) {
boolean show = nosim.equals("show"); mHasNoSims = nosim.equals("show");
mCallbackHandler.setNoSims(show); mCallbackHandler.setNoSims(mHasNoSims);
} }
String mobile = args.getString("mobile"); String mobile = args.getString("mobile");
if (mobile != null) { if (mobile != null) {

View File

@@ -131,11 +131,14 @@ public class DemoModeFragment extends PreferenceFragment implements OnPreference
intent.putExtra("mobile", "show"); intent.putExtra("mobile", "show");
intent.putExtra("sims", "1"); intent.putExtra("sims", "1");
intent.putExtra("nosim", "false"); intent.putExtra("nosim", "false");
intent.putExtra("fully", "true");
intent.putExtra("level", "4"); intent.putExtra("level", "4");
intent.putExtra("datatypel", ""); intent.putExtra("datatypel", "");
getContext().sendBroadcast(intent); getContext().sendBroadcast(intent);
// Need to send this after so that the sim controller already exists.
intent.putExtra("fully", "true");
getContext().sendBroadcast(intent);
intent.putExtra(DemoMode.EXTRA_COMMAND, DemoMode.COMMAND_BATTERY); intent.putExtra(DemoMode.EXTRA_COMMAND, DemoMode.COMMAND_BATTERY);
intent.putExtra("level", "100"); intent.putExtra("level", "100");
intent.putExtra("plugged", "false"); intent.putExtra("plugged", "false");