Migrate SIM operation dialog from LPA to Settings

In Android R, when users enable, disable, delete, or rename a profile,
Settings calls SubscriptionManager APIs which telephony ends up to send
actions “TOGGLE_SUBSCRIPTION_PRIVILEGED”,
“DELETE_SUBSCRIPTION_PRIVILEGED”, and “RENAME_SUBSCRIPTION_PRIVILEGED”
to EuiccManager. After EuiccUiDispatcher dispatches the action, Google
LPA receives it and starts the corresponding operations and DSDS
dialogs. We can see there some back-and-forth that goes on between LPA
and telephony. In order to improve the current structure, we devided
to move the dialogs to Settings and make it call EuiccManager APIs
directly.

Bug: 160819390
Test: Manually tested eSIM profile disabling.
Design: https://docs.google.com/document/d/1wb5_hoBkZVbkXGNWHbx4Jf61swjfxsJzkytiTzJosYo/edit?usp=sharing
Change-Id: Ib933df42ca3606de2310edc4d64c3e11800a1096
This commit is contained in:
Jiashen Wang
2020-09-08 15:57:40 -07:00
parent 7a7af7e23d
commit d8bd3bb669
8 changed files with 905 additions and 0 deletions

View File

@@ -0,0 +1,94 @@
/*
* Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.network.telephony;
import android.R;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import androidx.appcompat.app.AlertDialog;
/** The base class for subscription action dialogs */
public class SubscriptionActionDialogActivity extends Activity {
private static final String TAG = "SubscriptionActionDialogActivity";
private ProgressDialog mProgressDialog;
private AlertDialog mErrorDialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
/**
* Displays a loading dialog.
*
* @param message The string content should be displayed in the progress dialog.
*/
protected void showProgressDialog(String message) {
if (mProgressDialog == null) {
mProgressDialog = ProgressDialog.show(this, null, message);
mProgressDialog.setCanceledOnTouchOutside(false);
mProgressDialog.setCancelable(false);
}
mProgressDialog.setMessage(message);
mProgressDialog.show();
}
/** Dismisses the loading dialog. */
protected void dismissProgressDialog() {
if (mProgressDialog != null) {
mProgressDialog.dismiss();
}
}
/**
* Displays an error dialog to indicate the subscription action failure.
*
* @param title The title of the error dialog.
* @param message The body text of the error dialog.
* @param positiveOnClickListener The callback function after users confirm with the error.
*/
protected void showErrorDialog(
String title, String message, DialogInterface.OnClickListener positiveOnClickListener) {
if (mErrorDialog == null) {
mErrorDialog =
new AlertDialog.Builder(this)
.setTitle(title)
.setMessage(message)
.setPositiveButton(
R.string.ok,
(dialog, which) -> {
positiveOnClickListener.onClick(dialog, which);
dismissErrorDialog();
})
.create();
}
mErrorDialog.setMessage(message);
mErrorDialog.show();
}
/** Dismisses the error dialog. */
protected void dismissErrorDialog() {
if (mErrorDialog != null) {
mErrorDialog.dismiss();
}
}
}