Add switch to enable/disable cbrs
Add switch to enable or disable cbrs based on whether it is supported or not Bug: 121291721 Test: Tested enable/disable of the setting on device Change-Id: Ia79b177966412b2128a6d9cab3549d704253d7b5
This commit is contained in:
@@ -174,6 +174,20 @@
|
|||||||
android:layout_height="1dip"
|
android:layout_height="1dip"
|
||||||
android:background="?android:attr/listDivider" />
|
android:background="?android:attr/listDivider" />
|
||||||
|
|
||||||
|
<!-- Enable/Disable CBRS data -->
|
||||||
|
<Switch android:id="@+id/cbrs_data_switch"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:layout_marginTop="8dip"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/cbrs_data_switch_string" />
|
||||||
|
|
||||||
|
<!-- Horizontal Rule -->
|
||||||
|
<View
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="1dip"
|
||||||
|
android:background="?android:attr/listDivider" />
|
||||||
|
|
||||||
<!-- Ping stats -->
|
<!-- Ping stats -->
|
||||||
<Button android:id="@+id/ping_test"
|
<Button android:id="@+id/ping_test"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
|
@@ -63,6 +63,9 @@
|
|||||||
<!-- EAB provisioning flag on. Only shown in diagnostic screen, so precise translation is not needed. -->
|
<!-- EAB provisioning flag on. Only shown in diagnostic screen, so precise translation is not needed. -->
|
||||||
<string name="eab_provisioned_switch_string">EAB/Presence Provisioned</string>
|
<string name="eab_provisioned_switch_string">EAB/Presence Provisioned</string>
|
||||||
|
|
||||||
|
<!-- Cbrs enable disable flag. Only shown in diagnostic screen, so precise translation is not needed -->
|
||||||
|
<string name="cbrs_data_switch_string">Cbrs Data</string>
|
||||||
|
|
||||||
<!-- Title for controlling on/off for Mobile phone's radio power. Only shown in diagnostic screen, so precise translation is not needed. -->
|
<!-- Title for controlling on/off for Mobile phone's radio power. Only shown in diagnostic screen, so precise translation is not needed. -->
|
||||||
<string name="radio_info_radio_power">Mobile Radio Power</string>
|
<string name="radio_info_radio_power">Mobile Radio Power</string>
|
||||||
|
|
||||||
|
@@ -213,6 +213,7 @@ public class RadioInfo extends Activity {
|
|||||||
private Switch imsVtProvisionedSwitch;
|
private Switch imsVtProvisionedSwitch;
|
||||||
private Switch imsWfcProvisionedSwitch;
|
private Switch imsWfcProvisionedSwitch;
|
||||||
private Switch eabProvisionedSwitch;
|
private Switch eabProvisionedSwitch;
|
||||||
|
private Switch cbrsDataSwitch;
|
||||||
private Spinner preferredNetworkType;
|
private Spinner preferredNetworkType;
|
||||||
private Spinner cellInfoRefreshRateSpinner;
|
private Spinner cellInfoRefreshRateSpinner;
|
||||||
|
|
||||||
@@ -450,6 +451,9 @@ public class RadioInfo extends Activity {
|
|||||||
imsWfcProvisionedSwitch = (Switch) findViewById(R.id.wfc_provisioned_switch);
|
imsWfcProvisionedSwitch = (Switch) findViewById(R.id.wfc_provisioned_switch);
|
||||||
eabProvisionedSwitch = (Switch) findViewById(R.id.eab_provisioned_switch);
|
eabProvisionedSwitch = (Switch) findViewById(R.id.eab_provisioned_switch);
|
||||||
|
|
||||||
|
cbrsDataSwitch = (Switch) findViewById(R.id.cbrs_data_switch);
|
||||||
|
cbrsDataSwitch.setVisibility(isCbrsSupported() ? View.VISIBLE : View.GONE);
|
||||||
|
|
||||||
radioPowerOnSwitch = (Switch) findViewById(R.id.radio_power);
|
radioPowerOnSwitch = (Switch) findViewById(R.id.radio_power);
|
||||||
|
|
||||||
mDownlinkKbps = (TextView) findViewById(R.id.dl_kbps);
|
mDownlinkKbps = (TextView) findViewById(R.id.dl_kbps);
|
||||||
@@ -526,6 +530,11 @@ public class RadioInfo extends Activity {
|
|||||||
imsWfcProvisionedSwitch.setOnCheckedChangeListener(mImsWfcCheckedChangeListener);
|
imsWfcProvisionedSwitch.setOnCheckedChangeListener(mImsWfcCheckedChangeListener);
|
||||||
eabProvisionedSwitch.setOnCheckedChangeListener(mEabCheckedChangeListener);
|
eabProvisionedSwitch.setOnCheckedChangeListener(mEabCheckedChangeListener);
|
||||||
|
|
||||||
|
if (isCbrsSupported()) {
|
||||||
|
cbrsDataSwitch.setChecked(getCbrsDataState());
|
||||||
|
cbrsDataSwitch.setOnCheckedChangeListener(mCbrsDataSwitchChangeListener);
|
||||||
|
}
|
||||||
|
|
||||||
mTelephonyManager.listen(mPhoneStateListener,
|
mTelephonyManager.listen(mPhoneStateListener,
|
||||||
PhoneStateListener.LISTEN_CALL_STATE
|
PhoneStateListener.LISTEN_CALL_STATE
|
||||||
//b/27803938 - RadioInfo currently cannot read PRECISE_CALL_STATE
|
//b/27803938 - RadioInfo currently cannot read PRECISE_CALL_STATE
|
||||||
@@ -1483,4 +1492,38 @@ public class RadioInfo extends Activity {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
boolean isCbrsSupported() {
|
||||||
|
return getResources().getBoolean(
|
||||||
|
com.android.internal.R.bool.config_cbrs_supported);
|
||||||
|
}
|
||||||
|
|
||||||
|
void updateCbrsDataState(boolean state) {
|
||||||
|
Log.d(TAG, "setCbrsDataSwitchState() state:" + ((state)? "on":"off"));
|
||||||
|
if (mTelephonyManager != null) {
|
||||||
|
QueuedWork.queue(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
mTelephonyManager.setOpportunisticNetworkState(state);
|
||||||
|
cbrsDataSwitch.setChecked(getCbrsDataState());
|
||||||
|
}
|
||||||
|
}, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean getCbrsDataState() {
|
||||||
|
boolean state = false;
|
||||||
|
if (mTelephonyManager != null) {
|
||||||
|
state = mTelephonyManager.isOpportunisticNetworkEnabled();
|
||||||
|
}
|
||||||
|
Log.d(TAG, "getCbrsDataState() state:" +((state)? "on":"off"));
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
OnCheckedChangeListener mCbrsDataSwitchChangeListener = new OnCheckedChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
|
updateCbrsDataState(isChecked);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user