summaryrefslogtreecommitdiffstats
path: root/core/java/com
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/com')
-rw-r--r--core/java/com/android/internal/logging/MetricsConstants.java24
-rw-r--r--core/java/com/android/internal/logging/MetricsLogger.java19
-rw-r--r--core/java/com/android/internal/os/storage/ExternalStorageFormatter.java146
3 files changed, 25 insertions, 164 deletions
diff --git a/core/java/com/android/internal/logging/MetricsConstants.java b/core/java/com/android/internal/logging/MetricsConstants.java
index 8c6b79b..7278d5c 100644
--- a/core/java/com/android/internal/logging/MetricsConstants.java
+++ b/core/java/com/android/internal/logging/MetricsConstants.java
@@ -22,6 +22,7 @@ package com.android.internal.logging;
*/
public interface MetricsConstants {
// These constants must match those in the analytic pipeline, do not edit.
+ // Add temporary values to the top of MetricsLogger instead.
public static final int VIEW_UNKNOWN = 0;
public static final int MAIN_SETTINGS = 1;
public static final int ACCESSIBILITY = 2;
@@ -229,6 +230,29 @@ public interface MetricsConstants {
public static final int ACTION_NOTE_CONTROLS = 204;
public static final int ACTION_NOTE_INFO = 205;
public static final int ACTION_APP_NOTE_SETTINGS = 206;
+ public static final int VOLUME_DIALOG = 207;
+ public static final int VOLUME_DIALOG_DETAILS = 208;
+ public static final int ACTION_VOLUME_SLIDER = 209;
+ public static final int ACTION_VOLUME_STREAM = 210;
+ public static final int ACTION_VOLUME_KEY = 211;
+ public static final int ACTION_VOLUME_ICON = 212;
+ public static final int ACTION_RINGER_MODE = 213;
+ public static final int ACTION_ACTIVITY_CHOOSER_SHOWN = 214;
+ public static final int ACTION_ACTIVITY_CHOOSER_PICKED_APP_TARGET = 215;
+ public static final int ACTION_ACTIVITY_CHOOSER_PICKED_SERVICE_TARGET = 216;
+ public static final int ACTION_ACTIVITY_CHOOSER_PICKED_STANDARD_TARGET = 217;
+ public static final int ACTION_BRIGHTNESS = 218;
+ public static final int ACTION_BRIGHTNESS_AUTO = 219;
+ public static final int BRIGHTNESS_DIALOG = 220;
+ public static final int SYSTEM_ALERT_WINDOW_APPS = 221;
+ public static final int DREAMING = 222;
+ public static final int DOZING = 223;
+ public static final int OVERVIEW_ACTIVITY = 224;
+ public static final int ABOUT_LEGAL_SETTINGS = 225;
+ public static final int ACTION_SEARCH_RESULTS = 226;
+
+ // These constants must match those in the analytic pipeline, do not edit.
+ // Add temporary values to the top of MetricsLogger instead.
//aliases
public static final int DEVICEINFO_STORAGE = DEVICEINFO_MEMORY;
diff --git a/core/java/com/android/internal/logging/MetricsLogger.java b/core/java/com/android/internal/logging/MetricsLogger.java
index 66fa8fc..cbe535f 100644
--- a/core/java/com/android/internal/logging/MetricsLogger.java
+++ b/core/java/com/android/internal/logging/MetricsLogger.java
@@ -26,25 +26,8 @@ import android.view.View;
* @hide
*/
public class MetricsLogger implements MetricsConstants {
- public static final int VOLUME_DIALOG = 207;
- public static final int VOLUME_DIALOG_DETAILS = 208;
- public static final int ACTION_VOLUME_SLIDER = 209;
- public static final int ACTION_VOLUME_STREAM = 210;
- public static final int ACTION_VOLUME_KEY = 211;
- public static final int ACTION_VOLUME_ICON = 212;
- public static final int ACTION_RINGER_MODE = 213;
- public static final int ACTION_ACTIVITY_CHOOSER_SHOWN = 214;
- public static final int ACTION_ACTIVITY_CHOOSER_PICKED_APP_TARGET = 215;
- public static final int ACTION_ACTIVITY_CHOOSER_PICKED_SERVICE_TARGET = 216;
- public static final int ACTION_ACTIVITY_CHOOSER_PICKED_STANDARD_TARGET = 217;
- public static final int ACTION_BRIGHTNESS = 218;
- public static final int ACTION_BRIGHTNESS_AUTO = 219;
- public static final int BRIGHTNESS_DIALOG = 220;
- public static final int SYSTEM_ALERT_WINDOW_APPS = 221;
- public static final int DREAMING = 222;
- public static final int DOZING = 223;
- public static final int OVERVIEW_ACTIVITY = 224;
// Temporary constants go here, to await migration to MetricsConstants.
+ // next value is 227;
public static void visible(Context context, int category) throws IllegalArgumentException {
if (Build.IS_DEBUGGABLE && category == VIEW_UNKNOWN) {
diff --git a/core/java/com/android/internal/os/storage/ExternalStorageFormatter.java b/core/java/com/android/internal/os/storage/ExternalStorageFormatter.java
deleted file mode 100644
index 0a01ae9..0000000
--- a/core/java/com/android/internal/os/storage/ExternalStorageFormatter.java
+++ /dev/null
@@ -1,146 +0,0 @@
-package com.android.internal.os.storage;
-
-import android.app.ProgressDialog;
-import android.app.Service;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.os.IBinder;
-import android.os.PowerManager;
-import android.os.storage.StorageManager;
-import android.os.storage.StorageVolume;
-import android.util.Slog;
-import android.view.WindowManager;
-import android.widget.Toast;
-
-import com.android.internal.R;
-
-/**
- * Takes care of unmounting and formatting external storage.
- *
- * @deprecated Please use {@link Intent#ACTION_MASTER_CLEAR} broadcast with extra
- * {@link Intent#EXTRA_WIPE_EXTERNAL_STORAGE} to wipe and factory reset, or call
- * {@link StorageManager#wipeAdoptableDisks} directly to format external storages.
- */
-public class ExternalStorageFormatter extends Service {
- static final String TAG = "ExternalStorageFormatter";
-
- public static final String FORMAT_ONLY = "com.android.internal.os.storage.FORMAT_ONLY";
- public static final String FORMAT_AND_FACTORY_RESET = "com.android.internal.os.storage.FORMAT_AND_FACTORY_RESET";
-
- public static final String EXTRA_ALWAYS_RESET = "always_reset";
-
- public static final ComponentName COMPONENT_NAME
- = new ComponentName("android", ExternalStorageFormatter.class.getName());
-
- private StorageManager mStorageManager;
-
- private PowerManager.WakeLock mWakeLock;
-
- private ProgressDialog mProgressDialog = null;
-
- private boolean mFactoryReset = false;
- private boolean mAlwaysReset = false;
- private String mReason = null;
-
- @Override
- public void onCreate() {
- super.onCreate();
-
- mStorageManager = getSystemService(StorageManager.class);
-
- mWakeLock = ((PowerManager)getSystemService(Context.POWER_SERVICE))
- .newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "ExternalStorageFormatter");
- mWakeLock.acquire();
- }
-
- @Override
- public int onStartCommand(Intent intent, int flags, int startId) {
- if (FORMAT_AND_FACTORY_RESET.equals(intent.getAction())) {
- mFactoryReset = true;
- }
- if (intent.getBooleanExtra(EXTRA_ALWAYS_RESET, false)) {
- mAlwaysReset = true;
- }
-
- mReason = intent.getStringExtra(Intent.EXTRA_REASON);
- StorageVolume userVol = intent.getParcelableExtra(StorageVolume.EXTRA_STORAGE_VOLUME);
- if (userVol == null) {
- Slog.w(TAG, "Missing explicit storage volume; assuming default");
- userVol = mStorageManager.getPrimaryVolume();
- }
-
- final String volumeId = userVol.getId();
-
- mProgressDialog = new ProgressDialog(this);
- mProgressDialog.setIndeterminate(true);
- mProgressDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
- mProgressDialog.setMessage(getText(R.string.progress_unmounting));
- mProgressDialog.show();
-
- new FormatTask(volumeId).start();
-
- return Service.START_REDELIVER_INTENT;
- }
-
- private class FormatTask extends Thread {
- private final String mVolumeId;
-
- public FormatTask(String volumeId) {
- mVolumeId = volumeId;
- }
-
- @Override
- public void run() {
- boolean success = false;
- try {
- mStorageManager.format(mVolumeId);
- success = true;
- } catch (Exception e) {
- Slog.w(TAG, "Failed to format", e);
- Toast.makeText(ExternalStorageFormatter.this,
- R.string.format_error, Toast.LENGTH_LONG).show();
- }
- if (success) {
- if (mFactoryReset) {
- Intent intent = new Intent(Intent.ACTION_MASTER_CLEAR);
- intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
- intent.putExtra(Intent.EXTRA_REASON, mReason);
- sendBroadcast(intent);
- // Intent handling is asynchronous -- assume it will happen soon.
- stopSelf();
- return;
- }
- }
- // If we didn't succeed, or aren't doing a full factory
- // reset, then it is time to remount the storage.
- if (!success && mAlwaysReset) {
- Intent intent = new Intent(Intent.ACTION_MASTER_CLEAR);
- intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
- intent.putExtra(Intent.EXTRA_REASON, mReason);
- sendBroadcast(intent);
- } else {
- try {
- mStorageManager.mount(mVolumeId);
- } catch (Exception e) {
- Slog.w(TAG, "Failed to mount", e);
- }
- }
- stopSelf();
- }
- }
-
- @Override
- public void onDestroy() {
- if (mProgressDialog != null) {
- mProgressDialog.dismiss();
- }
- mWakeLock.release();
- super.onDestroy();
- }
-
- @Override
- public IBinder onBind(Intent intent) {
- return null;
- }
-}