[Settings] Add flag Intent.FLAG_GRANT_READ_URI_PERMISSION
Add flag for startActivity() with URI. Bug: 150352656 Test: make Change-Id: I7292f3802e22a73dc61cbbb5551c12ca05261629
This commit is contained in:
@@ -61,13 +61,13 @@ public class ApnPreference extends Preference implements CompoundButton.OnChecke
|
|||||||
public void onBindViewHolder(PreferenceViewHolder view) {
|
public void onBindViewHolder(PreferenceViewHolder view) {
|
||||||
super.onBindViewHolder(view);
|
super.onBindViewHolder(view);
|
||||||
|
|
||||||
View widget = view.findViewById(R.id.apn_radiobutton);
|
final View widget = view.findViewById(R.id.apn_radiobutton);
|
||||||
if ((widget != null) && widget instanceof RadioButton) {
|
if ((widget != null) && widget instanceof RadioButton) {
|
||||||
RadioButton rb = (RadioButton) widget;
|
final RadioButton rb = (RadioButton) widget;
|
||||||
if (mSelectable) {
|
if (mSelectable) {
|
||||||
rb.setOnCheckedChangeListener(this);
|
rb.setOnCheckedChangeListener(this);
|
||||||
|
|
||||||
boolean isChecked = getKey().equals(mSelectedKey);
|
final boolean isChecked = getKey().equals(mSelectedKey);
|
||||||
if (isChecked) {
|
if (isChecked) {
|
||||||
mCurrentChecked = rb;
|
mCurrentChecked = rb;
|
||||||
mSelectedKey = getKey();
|
mSelectedKey = getKey();
|
||||||
@@ -113,17 +113,18 @@ public class ApnPreference extends Preference implements CompoundButton.OnChecke
|
|||||||
@Override
|
@Override
|
||||||
protected void onClick() {
|
protected void onClick() {
|
||||||
super.onClick();
|
super.onClick();
|
||||||
Context context = getContext();
|
final Context context = getContext();
|
||||||
if (context != null) {
|
if (context != null) {
|
||||||
if (mHideDetails) {
|
if (mHideDetails) {
|
||||||
Toast.makeText(context, context.getString(
|
Toast.makeText(context, context.getString(
|
||||||
R.string.cannot_change_apn_toast), Toast.LENGTH_LONG).show();
|
R.string.cannot_change_apn_toast), Toast.LENGTH_LONG).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int pos = Integer.parseInt(getKey());
|
final int pos = Integer.parseInt(getKey());
|
||||||
Uri url = ContentUris.withAppendedId(Telephony.Carriers.CONTENT_URI, pos);
|
final Uri url = ContentUris.withAppendedId(Telephony.Carriers.CONTENT_URI, pos);
|
||||||
Intent editIntent = new Intent(Intent.ACTION_EDIT, url);
|
final Intent editIntent = new Intent(Intent.ACTION_EDIT, url);
|
||||||
editIntent.putExtra(ApnSettings.SUB_ID, mSubId);
|
editIntent.putExtra(ApnSettings.SUB_ID, mSubId);
|
||||||
|
editIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||||
context.startActivity(editIntent);
|
context.startActivity(editIntent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user