diff options
author | Dianne Hackborn <hackbod@google.com> | 2012-07-13 13:24:15 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2012-08-07 11:42:09 -0700 |
commit | 5773bfdb7cd3852d9fedd497e3c22c49c83d0d75 (patch) | |
tree | 19e5d24fdfc33d3c1cf31defa454b52ab9a167ec /policy | |
parent | 4cb3384772cf7015a4e05789470123efb07219d9 (diff) | |
download | frameworks_base-5773bfdb7cd3852d9fedd497e3c22c49c83d0d75.zip frameworks_base-5773bfdb7cd3852d9fedd497e3c22c49c83d0d75.tar.gz frameworks_base-5773bfdb7cd3852d9fedd497e3c22c49c83d0d75.tar.bz2 |
Add power menu action to take a bug report
Change-Id: I5f58d99e9a27a1fc496fa54e0c0ee333087155da
Diffstat (limited to 'policy')
-rw-r--r-- | policy/src/com/android/internal/policy/impl/GlobalActions.java | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/policy/src/com/android/internal/policy/impl/GlobalActions.java b/policy/src/com/android/internal/policy/impl/GlobalActions.java index e9b8267..6c50f1c 100644 --- a/policy/src/com/android/internal/policy/impl/GlobalActions.java +++ b/policy/src/com/android/internal/policy/impl/GlobalActions.java @@ -30,7 +30,6 @@ import android.content.IntentFilter; import android.content.pm.UserInfo; import android.database.ContentObserver; import android.graphics.drawable.Drawable; -import android.graphics.drawable.ScaleDrawable; import android.media.AudioManager; import android.net.ConnectivityManager; import android.os.Handler; @@ -45,7 +44,6 @@ import android.telephony.PhoneStateListener; import android.telephony.ServiceState; import android.telephony.TelephonyManager; import android.util.Log; -import android.view.Gravity; import android.view.IWindowManager; import android.view.LayoutInflater; import android.view.View; @@ -231,6 +229,50 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac // next: airplane mode mItems.add(mAirplaneModeOn); + // next: bug report, if enabled + if (Settings.Secure.getInt(mContext.getContentResolver(), + Settings.Secure.BUGREPORT_IN_POWER_MENU, 0) != 0) { + mItems.add( + new SinglePressAction(0, R.string.global_action_bug_report) { + + public void onPress() { + AlertDialog.Builder builder = new AlertDialog.Builder(mContext); + builder.setTitle(com.android.internal.R.string.bugreport_title); + builder.setMessage(com.android.internal.R.string.bugreport_message); + builder.setNegativeButton(com.android.internal.R.string.cancel, null); + builder.setPositiveButton(com.android.internal.R.string.report, + new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + // Add a little delay before executing, to give the + // dialog a chance to go away before it takes a + // screenshot. + mHandler.postDelayed(new Runnable() { + @Override public void run() { + SystemProperties.set("ctl.start", "bugreport"); + } + }, 500); + } + }); + AlertDialog dialog = builder.create(); + dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG); + dialog.show(); + } + + public boolean onLongPress() { + return false; + } + + public boolean showDuringKeyguard() { + return true; + } + + public boolean showBeforeProvisioning() { + return false; + } + }); + } + // last: silent mode if (SHOW_SILENT_TOGGLE) { mItems.add(mSilentModeAction); |