Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
58443a8620 | ||
|
83f8afa3a1 | ||
|
615f709c03 |
@@ -76,7 +76,7 @@
|
|||||||
android:label="@string/product_name"
|
android:label="@string/product_name"
|
||||||
android:launchMode="singleInstance"
|
android:launchMode="singleInstance"
|
||||||
android:excludeFromRecents="true"
|
android:excludeFromRecents="true"
|
||||||
android:configChanges="mcc|mnc|themeChange"
|
android:configChanges="mcc|mnc"
|
||||||
android:immersive="true"
|
android:immersive="true"
|
||||||
android:windowSoftInputMode="stateAlwaysHidden">
|
android:windowSoftInputMode="stateAlwaysHidden">
|
||||||
|
|
||||||
|
@@ -51,7 +51,9 @@ public class CMSetupWizardData extends AbstractSetupData {
|
|||||||
pages.add(new BluetoothSetupPage(mContext, this));
|
pages.add(new BluetoothSetupPage(mContext, this));
|
||||||
}
|
}
|
||||||
pages.add(new WelcomePage(mContext, this));
|
pages.add(new WelcomePage(mContext, this));
|
||||||
|
if (SetupWizardUtils.hasWifi(mContext)) {
|
||||||
pages.add(new WifiSetupPage(mContext, this));
|
pages.add(new WifiSetupPage(mContext, this));
|
||||||
|
}
|
||||||
if (SetupWizardUtils.hasTelephony(mContext)) {
|
if (SetupWizardUtils.hasTelephony(mContext)) {
|
||||||
pages.add(new SimCardMissingPage(mContext, this)
|
pages.add(new SimCardMissingPage(mContext, this)
|
||||||
.setHidden(isSimInserted()));
|
.setHidden(isSimInserted()));
|
||||||
|
@@ -188,7 +188,7 @@ public class ChooseDataSimPage extends SetupPage {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
mContext = getActivity().getApplicationContext();
|
mContext = getActivity().getApplicationContext();
|
||||||
mSubscriptionManager = SubscriptionManager.from(mContext);
|
mSubscriptionManager = SubscriptionManager.from(mContext);
|
||||||
mCurrentDataSubId = mSubscriptionManager.getDefaultDataSubId();
|
mCurrentDataSubId = mSubscriptionManager.getDefaultSubscriptionId();
|
||||||
if (sChangingToDataSubId == -1) {
|
if (sChangingToDataSubId == -1) {
|
||||||
sChangingToDataSubId = mCurrentDataSubId;
|
sChangingToDataSubId = mCurrentDataSubId;
|
||||||
}
|
}
|
||||||
@@ -256,7 +256,7 @@ public class ChooseDataSimPage extends SetupPage {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDataConnectionStateChanged(int state) {
|
public void onDataConnectionStateChanged(int state) {
|
||||||
final int dataSubId = mSubscriptionManager.getDefaultDataSubId();
|
final int dataSubId = mSubscriptionManager.getDefaultSubscriptionId();
|
||||||
// In case the default sub changes from elsewhere. This shouldn't happen,
|
// In case the default sub changes from elsewhere. This shouldn't happen,
|
||||||
// but testcases can induce this.
|
// but testcases can induce this.
|
||||||
if (dataSubId != mCurrentDataSubId &&
|
if (dataSubId != mCurrentDataSubId &&
|
||||||
@@ -370,7 +370,7 @@ public class ChooseDataSimPage extends SetupPage {
|
|||||||
if (mIsAttached) {
|
if (mIsAttached) {
|
||||||
for (int i = 0; i < mSubInfoRecords.size(); i++) {
|
for (int i = 0; i < mSubInfoRecords.size(); i++) {
|
||||||
SubscriptionInfo subInfoRecord = mSubInfoRecords.valueAt(i);
|
SubscriptionInfo subInfoRecord = mSubInfoRecords.valueAt(i);
|
||||||
mCheckBoxes.get(i).setChecked(mSubscriptionManager.getDefaultDataSubId()
|
mCheckBoxes.get(i).setChecked(mSubscriptionManager.getDefaultSubscriptionId()
|
||||||
== subInfoRecord.getSubscriptionId());
|
== subInfoRecord.getSubscriptionId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -395,7 +395,7 @@ public class ChooseDataSimPage extends SetupPage {
|
|||||||
|
|
||||||
private void updateCarrierText(SubscriptionInfo subInfoRecord) {
|
private void updateCarrierText(SubscriptionInfo subInfoRecord) {
|
||||||
if (mIsAttached) {
|
if (mIsAttached) {
|
||||||
String name = mPhone.getSimOperatorNameForSubscription(subInfoRecord.getSubscriptionId());
|
String name = mPhone.getSimOperatorName(subInfoRecord.getSubscriptionId());
|
||||||
if (TextUtils.isEmpty(name)) {
|
if (TextUtils.isEmpty(name)) {
|
||||||
name = mPhone.getNetworkOperatorName(subInfoRecord.getSubscriptionId());
|
name = mPhone.getNetworkOperatorName(subInfoRecord.getSubscriptionId());
|
||||||
}
|
}
|
||||||
|
@@ -110,7 +110,7 @@ public class MobileDataPage extends SetupPage {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private PhoneStateListener mPhoneStateListener =
|
private PhoneStateListener mPhoneStateListener =
|
||||||
new PhoneStateListener(SubscriptionManager.getDefaultDataSubId()) {
|
new PhoneStateListener(SubscriptionManager.getDefaultSubscriptionId()) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
|
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
|
||||||
@@ -241,10 +241,9 @@ public class MobileDataPage extends SetupPage {
|
|||||||
|
|
||||||
private void updateCarrierText() {
|
private void updateCarrierText() {
|
||||||
if (mIsAttached) {
|
if (mIsAttached) {
|
||||||
String name =
|
String name = mPhone.getSimOperatorName(SubscriptionManager.getDefaultSubscriptionId());
|
||||||
mPhone.getSimOperatorNameForSubscription(SubscriptionManager.getDefaultDataSubId());
|
|
||||||
if (TextUtils.isEmpty(name)) {
|
if (TextUtils.isEmpty(name)) {
|
||||||
name = mPhone.getNetworkOperatorName(SubscriptionManager.getDefaultDataSubId());
|
name = mPhone.getNetworkOperatorName(SubscriptionManager.getDefaultSubscriptionId());
|
||||||
}
|
}
|
||||||
if (TextUtils.isEmpty(name)) {
|
if (TextUtils.isEmpty(name)) {
|
||||||
if (mServiceState != null && mServiceState.isEmergencyOnly()) {
|
if (mServiceState != null && mServiceState.isEmergencyOnly()) {
|
||||||
|
@@ -26,9 +26,9 @@ import android.content.res.Resources;
|
|||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Point;
|
import android.graphics.Point;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
|
import android.os.Binder;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.UserHandle;
|
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
@@ -377,7 +377,7 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks,
|
|||||||
final SetupWizardApp setupWizardApp = (SetupWizardApp)getApplication();
|
final SetupWizardApp setupWizardApp = (SetupWizardApp)getApplication();
|
||||||
setupWizardApp.sendStickyBroadcastAsUser(
|
setupWizardApp.sendStickyBroadcastAsUser(
|
||||||
new Intent(SetupWizardApp.ACTION_FINISHED),
|
new Intent(SetupWizardApp.ACTION_FINISHED),
|
||||||
UserHandle.getCallingUserHandle());
|
Binder.getCallingUserHandle());
|
||||||
mIsFinishing = true;
|
mIsFinishing = true;
|
||||||
setupRevealImage();
|
setupRevealImage();
|
||||||
}
|
}
|
||||||
|
@@ -27,7 +27,7 @@ import android.hardware.fingerprint.FingerprintManager;
|
|||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.net.NetworkInfo;
|
import android.net.NetworkInfo;
|
||||||
import android.net.wifi.WifiManager;
|
import android.net.wifi.WifiManager;
|
||||||
import android.os.UserHandle;
|
import android.os.Binder;
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
import android.service.persistentdata.PersistentDataBlockManager;
|
import android.service.persistentdata.PersistentDataBlockManager;
|
||||||
import android.telephony.ServiceState;
|
import android.telephony.ServiceState;
|
||||||
@@ -92,7 +92,7 @@ public class SetupWizardUtils {
|
|||||||
int phoneId = SubscriptionManager.from(context).getDefaultDataPhoneId();
|
int phoneId = SubscriptionManager.from(context).getDefaultDataPhoneId();
|
||||||
android.provider.Settings.Global.putInt(context.getContentResolver(),
|
android.provider.Settings.Global.putInt(context.getContentResolver(),
|
||||||
android.provider.Settings.Global.MOBILE_DATA + phoneId, enabled ? 1 : 0);
|
android.provider.Settings.Global.MOBILE_DATA + phoneId, enabled ? 1 : 0);
|
||||||
int subId = SubscriptionManager.getDefaultDataSubId();
|
int subId = SubscriptionManager.getDefaultDataSubscriptionId();
|
||||||
tm.setDataEnabled(subId, enabled);
|
tm.setDataEnabled(subId, enabled);
|
||||||
} else {
|
} else {
|
||||||
android.provider.Settings.Global.putInt(context.getContentResolver(),
|
android.provider.Settings.Global.putInt(context.getContentResolver(),
|
||||||
@@ -101,6 +101,11 @@ public class SetupWizardUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean hasWifi(Context context) {
|
||||||
|
PackageManager packageManager = context.getPackageManager();
|
||||||
|
return packageManager.hasSystemFeature(PackageManager.FEATURE_WIFI);
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean hasTelephony(Context context) {
|
public static boolean hasTelephony(Context context) {
|
||||||
PackageManager packageManager = context.getPackageManager();
|
PackageManager packageManager = context.getPackageManager();
|
||||||
return packageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY);
|
return packageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY);
|
||||||
@@ -190,7 +195,7 @@ public class SetupWizardUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isOwner() {
|
public static boolean isOwner() {
|
||||||
return UserHandle.getCallingUserHandle().isOwner();
|
return Binder.getCallingUserHandle().isOwner();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasGMS(Context context) {
|
public static boolean hasGMS(Context context) {
|
||||||
|
Reference in New Issue
Block a user