diff options
author | msnider <msnider@google.com> | 2017-04-24 13:25:01 -0700 |
---|---|---|
committer | msnider <msnider@google.com> | 2017-04-24 13:27:53 -0700 |
commit | 429f8752da648d9cf463af21045d86948506f5b1 (patch) | |
tree | 05271ba6e4f538be7f8d59de4e4d91264109b336 | |
parent | ef54ec214414fa17bc2ada601fc2284d00b3804d (diff) | |
download | android_packages_apps_PackageInstaller-429f8752da648d9cf463af21045d86948506f5b1.tar.gz android_packages_apps_PackageInstaller-429f8752da648d9cf463af21045d86948506f5b1.tar.bz2 android_packages_apps_PackageInstaller-429f8752da648d9cf463af21045d86948506f5b1.zip |
Removing the ClearApplicationUserDataDialogActivity
See ag/2119036 in master for revert
Test: N/A
Bug: 37413812
Bug: 37497021
Bug: 37494148
Bug: 37414037
Change-Id: Iac5ae44c2fdf30efe256d9612d40524ddad123db
-rw-r--r-- | AndroidManifest.xml | 11 | ||||
-rw-r--r-- | res/values/strings.xml | 5 | ||||
-rw-r--r-- | src/com/android/packageinstaller/ClearApplicationUserDataDialogActivity.java | 174 |
3 files changed, 0 insertions, 190 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index e27bfd90..a43cb061 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -102,17 +102,6 @@ </intent-filter> </activity> - <activity android:name=".ClearApplicationUserDataDialogActivity" - android:configChanges="orientation|keyboardHidden|screenSize" - android:excludeFromRecents="true" - android:theme="@style/AlertDialogActivity"> - <intent-filter android:priority="1"> - <action android:name="android.intent.action.CLEAR_PACKAGE" /> - <category android:name="android.intent.category.DEFAULT" /> - <data android:scheme="package" /> - </intent-filter> - </activity> - <receiver android:name=".UninstallEventReceiver" android:permission="android.permission.INSTALL_PACKAGES" android:exported="true"> diff --git a/res/values/strings.xml b/res/values/strings.xml index 4b9e508d..9992a41f 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -334,11 +334,6 @@ <!-- Help URL, application permissions [DO NOT TRANSLATE] --> <string name="help_app_permissions" translatable="false"></string> - <!-- Confirm dialog text to verify if the user really wants to clear data for the provided - package. --> - <string name="clear_app_data_confirm_dialog">Do you really want to clear the data for - <xliff:g id="package" example="com.google.vending">%1$s</xliff:g>?</string> - <!-- Text to show in warning dialog on the tablet when the app source is not trusted [CHAR LIMIT=NONE] --> <string name="untrusted_external_source_warning" product="tablet">For your security, your tablet is not allowed to install unknown apps from this source.</string> diff --git a/src/com/android/packageinstaller/ClearApplicationUserDataDialogActivity.java b/src/com/android/packageinstaller/ClearApplicationUserDataDialogActivity.java deleted file mode 100644 index 92925b0b..00000000 --- a/src/com/android/packageinstaller/ClearApplicationUserDataDialogActivity.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright (C) 2017 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.packageinstaller; - -import android.app.Activity; -import android.app.AlertDialog; -import android.app.DialogFragment; -import android.app.Fragment; -import android.app.FragmentTransaction; -import android.content.DialogInterface; -import android.content.Intent; -import android.content.pm.ApplicationInfo; -import android.content.pm.IPackageManager; -import android.content.pm.PackageManager; -import android.content.res.Configuration; -import android.net.Uri; -import android.os.Bundle; -import android.os.Handler; -import android.os.RemoteException; -import android.os.ServiceManager; -import android.os.UserHandle; -import android.support.annotation.NonNull; -import android.support.annotation.StringRes; -import android.text.TextUtils; -import android.util.Log; - -import com.android.packageinstaller.handheld.ErrorDialogFragment; -import com.android.packageinstaller.television.ErrorFragment; - -/** - * This activity can be called to prompt the user to verify that they want to clear the data for - * the provided package. We expect an intent with URI of the form package://<packageName>. - */ -public class ClearApplicationUserDataDialogActivity extends Activity { - private static final String TAG = "ClearAppUserDataDialog"; - - private String mPackageName; - private IPackageManager mPackageManager; - private int mUserId; - - @Override - public void onCreate(Bundle icicle) { - super.onCreate(icicle); - // Get intent information. - // We expect an intent with URI of the form package://<packageName>. - final Intent intent = getIntent(); - final Uri packageUri = intent.getData(); - if (packageUri == null) { - Log.e(TAG, "No package URI in intent"); - showAppNotFound(); - return; - } - - mPackageName = packageUri.getEncodedSchemeSpecificPart(); - if (TextUtils.isEmpty(mPackageName)) { - Log.e(TAG, "Invalid package name in URI: " + packageUri); - showAppNotFound(); - return; - } - - mPackageManager = IPackageManager.Stub.asInterface( - ServiceManager.getService("package")); - UserHandle user = android.os.Process.myUserHandle(); - ApplicationInfo appInfo = null; - - try { - mUserId = user.getIdentifier(); - appInfo = mPackageManager.getApplicationInfo(mPackageName, - PackageManager.MATCH_UNINSTALLED_PACKAGES, mUserId); - } catch (RemoteException e) { - Log.e(TAG, "Unable to get packageName. Package manager is dead?"); - } - - if (appInfo == null) { - Log.e(TAG, "Invalid packageName: " + mPackageName); - showAppNotFound(); - return; - } - - showConfirmationDialog(); - } - - private void showConfirmationDialog() { - // Use the Builder class for convenient dialog construction - AlertDialog.Builder builder = new AlertDialog.Builder(this); - String message = getString(R.string.clear_app_data_confirm_dialog, mPackageName); - int okId = com.android.internal.R.string.ok; - int cancelId = com.android.internal.R.string.cancel; - builder.setMessage(message) - .setPositiveButton(okId, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - new Handler().post(new Runnable() { - public void run() { - try { - mPackageManager.clearApplicationUserData( - mPackageName, null /* observer */, mUserId); - } catch (RemoteException e) { - Log.e(TAG, - "Unable to clear user data. Package manager is dead?"); - } - } - }); - finish(); - } - }) - .setNegativeButton(cancelId, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - finish(); - } - }); - // Create the AlertDialog object and return it - AlertDialog dialog = builder.create(); - dialog.show(); - } - - private void showAppNotFound() { - if (isTv()) { - showContentFragment(new ErrorFragment(), R.string.app_not_found_dlg_title, - R.string.app_not_found_dlg_text); - } else { - showDialogFragment(new ErrorDialogFragment(), R.string.app_not_found_dlg_title, - R.string.app_not_found_dlg_text); - } - } - - private boolean isTv() { - return (getResources().getConfiguration().uiMode & Configuration.UI_MODE_TYPE_MASK) - == Configuration.UI_MODE_TYPE_TELEVISION; - } - - private void showContentFragment(@NonNull Fragment fragment, @StringRes int title, - @StringRes int text) { - Bundle args = new Bundle(); - args.putInt(ErrorFragment.TITLE, title); - args.putInt(ErrorFragment.TEXT, text); - fragment.setArguments(args); - - getFragmentManager().beginTransaction() - .replace(android.R.id.content, fragment) - .commit(); - } - - private void showDialogFragment(@NonNull DialogFragment fragment, - @StringRes int title, @StringRes int text) { - FragmentTransaction ft = getFragmentManager().beginTransaction(); - Fragment prev = getFragmentManager().findFragmentByTag("dialog"); - if (prev != null) { - ft.remove(prev); - } - - Bundle args = new Bundle(); - if (title != 0) { - args.putInt(ErrorDialogFragment.TITLE, title); - } - args.putInt(ErrorDialogFragment.TEXT, text); - - fragment.setArguments(args); - fragment.show(ft, "dialog"); - } -} |