Santos Cordon
2014-12-09 23:21:11 +00:00
committed by Android Git Automerger
3 changed files with 29 additions and 17 deletions

View File

@@ -966,22 +966,29 @@ public class DataUsageSummary extends HighlightingFragment implements Indexable
}
/**
* Local cache of value, used to work around delay when
* {@link ConnectivityManager#setMobileDataEnabled(boolean)} is async.
* Local cache of value, used to work around delays.
*/
private Boolean mMobileDataEnabled;
private boolean isMobileDataEnabled(int subId) {
if (LOGD) Log.d(TAG, "isMobileDataEnabled:+ subId=" + subId);
boolean isEnable = false;
if (mMobileDataEnabled != null) {
// TODO: deprecate and remove this once enabled flag is on policy
// Multiple Subscriptions, the value need to be reseted
isEnable = mMobileDataEnabled.booleanValue();
if (LOGD) {
Log.d(TAG, "isMobileDataEnabled: != null, subId=" + subId
+ " isEnable=" + isEnable);
}
mMobileDataEnabled = null;
} else {
//SUB SELECT
isEnable = mTelephonyManager.getDataEnabled()
&& (subId == mSubscriptionManager.getDefaultDataSubId());
// SUB SELECT
isEnable = mTelephonyManager.getDataEnabled(subId);
if (LOGD) {
Log.d(TAG, "isMobileDataEnabled: == null, subId=" + subId
+ " isEnable=" + isEnable);
}
}
return isEnable;
}

View File

@@ -50,6 +50,7 @@ public class VolumeSeekBarPreference extends SeekBarPreference
private boolean mMuted;
private int mIconResId;
private int mMuteIconResId;
private boolean mStopped;
public VolumeSeekBarPreference(Context context, AttributeSet attrs, int defStyleAttr,
int defStyleRes) {
@@ -77,8 +78,15 @@ public class VolumeSeekBarPreference extends SeekBarPreference
mCallback = callback;
}
public void onActivityResume() {
if (mStopped) {
init();
}
}
@Override
public void onActivityStop() {
mStopped = true;
if (mVolumizer != null) {
mVolumizer.stop();
}
@@ -91,10 +99,15 @@ public class VolumeSeekBarPreference extends SeekBarPreference
Log.w(TAG, "No stream found, not binding volumizer");
return;
}
mSeekBar = (SeekBar) view.findViewById(com.android.internal.R.id.seekbar);
mIconView = (ImageView) view.findViewById(com.android.internal.R.id.icon);
mSuppressionTextView = (TextView) view.findViewById(R.id.suppression_text);
init();
}
private void init() {
if (mSeekBar == null) return;
getPreferenceManager().registerOnActivityStopListener(this);
final SeekBar seekBar = (SeekBar) view.findViewById(com.android.internal.R.id.seekbar);
if (seekBar == mSeekBar) return;
mSeekBar = seekBar;
final SeekBarVolumizer.Callback sbvc = new SeekBarVolumizer.Callback() {
@Override
public void onSampleStarting(SeekBarVolumizer sbv) {
@@ -121,19 +134,11 @@ public class VolumeSeekBarPreference extends SeekBarPreference
}
mVolumizer.start();
mVolumizer.setSeekBar(mSeekBar);
mIconView = (ImageView) view.findViewById(com.android.internal.R.id.icon);
updateIconView();
mSuppressionTextView = (TextView) view.findViewById(R.id.suppression_text);
mCallback.onStreamValueChanged(mStream, mSeekBar.getProgress());
updateSuppressionText();
}
public void onActivityResume() {
if (mVolumizer != null) {
mVolumizer.start();
}
}
// during initialization, this preference is the SeekBar listener
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromTouch) {

View File

@@ -152,7 +152,7 @@ public class SimDialogActivity extends Activity {
final SubscriptionManager subscriptionManager = SubscriptionManager.from(context);
final List<SubscriptionInfo> subInfoList =
subscriptionManager.getActiveSubscriptionInfoList();
final int selectableSubInfoLength = subInfoList.size();
final int selectableSubInfoLength = subInfoList == null ? 0 : subInfoList.size();
final DialogInterface.OnClickListener selectionListener =
new DialogInterface.OnClickListener() {