am a4191505: Merge "Add power menu action to take a bug report" into jb-mr1-dev
* commit 'a419150573f4debba46f2341027d9c1230f3c53b': Add power menu action to take a bug report
This commit is contained in:
@@ -2584,6 +2584,13 @@ public final class Settings {
|
|||||||
*/
|
*/
|
||||||
public static final String DEVELOPMENT_SETTINGS_ENABLED = "development_settings_enabled";
|
public static final String DEVELOPMENT_SETTINGS_ENABLED = "development_settings_enabled";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When the user has enable the option to have a "bug report" command
|
||||||
|
* in the power menu.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final String BUGREPORT_IN_POWER_MENU = "bugreport_in_power_menu";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether ADB is enabled.
|
* Whether ADB is enabled.
|
||||||
*/
|
*/
|
||||||
@@ -4316,6 +4323,7 @@ public final class Settings {
|
|||||||
*/
|
*/
|
||||||
public static final String[] SETTINGS_TO_BACKUP = {
|
public static final String[] SETTINGS_TO_BACKUP = {
|
||||||
ADB_ENABLED,
|
ADB_ENABLED,
|
||||||
|
BUGREPORT_IN_POWER_MENU,
|
||||||
ALLOW_MOCK_LOCATION,
|
ALLOW_MOCK_LOCATION,
|
||||||
PARENTAL_CONTROL_ENABLED,
|
PARENTAL_CONTROL_ENABLED,
|
||||||
PARENTAL_CONTROL_REDIRECT_URL,
|
PARENTAL_CONTROL_REDIRECT_URL,
|
||||||
|
|||||||
@@ -1328,11 +1328,14 @@
|
|||||||
<java-symbol type="layout" name="screen_title_icons" />
|
<java-symbol type="layout" name="screen_title_icons" />
|
||||||
<java-symbol type="string" name="abbrev_wday_month_day_no_year" />
|
<java-symbol type="string" name="abbrev_wday_month_day_no_year" />
|
||||||
<java-symbol type="string" name="android_upgrading_title" />
|
<java-symbol type="string" name="android_upgrading_title" />
|
||||||
|
<java-symbol type="string" name="bugreport_title" />
|
||||||
|
<java-symbol type="string" name="bugreport_message" />
|
||||||
<java-symbol type="string" name="faceunlock_multiple_failures" />
|
<java-symbol type="string" name="faceunlock_multiple_failures" />
|
||||||
<java-symbol type="string" name="global_action_power_off" />
|
<java-symbol type="string" name="global_action_power_off" />
|
||||||
<java-symbol type="string" name="global_actions_airplane_mode_off_status" />
|
<java-symbol type="string" name="global_actions_airplane_mode_off_status" />
|
||||||
<java-symbol type="string" name="global_actions_airplane_mode_on_status" />
|
<java-symbol type="string" name="global_actions_airplane_mode_on_status" />
|
||||||
<java-symbol type="string" name="global_actions_toggle_airplane_mode" />
|
<java-symbol type="string" name="global_actions_toggle_airplane_mode" />
|
||||||
|
<java-symbol type="string" name="global_action_bug_report" />
|
||||||
<java-symbol type="string" name="global_action_silent_mode_off_status" />
|
<java-symbol type="string" name="global_action_silent_mode_off_status" />
|
||||||
<java-symbol type="string" name="global_action_silent_mode_on_status" />
|
<java-symbol type="string" name="global_action_silent_mode_on_status" />
|
||||||
<java-symbol type="string" name="global_action_toggle_silent_mode" />
|
<java-symbol type="string" name="global_action_toggle_silent_mode" />
|
||||||
|
|||||||
@@ -346,6 +346,17 @@
|
|||||||
<!-- label for item that turns off power in phone options dialog -->
|
<!-- label for item that turns off power in phone options dialog -->
|
||||||
<string name="global_action_power_off">Power off</string>
|
<string name="global_action_power_off">Power off</string>
|
||||||
|
|
||||||
|
<!-- label for item that generates a bug report in the phone options dialog -->
|
||||||
|
<string name="global_action_bug_report">Bug report</string>
|
||||||
|
|
||||||
|
<!-- Take bug report menu title [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="bugreport_title">Take bug report</string>
|
||||||
|
<!-- Message in bugreport dialog describing what it does [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="bugreport_message">This will collect information about your
|
||||||
|
current device state, to send as an e-mail message. It will take a little
|
||||||
|
time from starting the bug report until it is ready to be sent; please be
|
||||||
|
patient.</string>
|
||||||
|
|
||||||
<!-- label for item that enables silent mode in phone options dialog -->
|
<!-- label for item that enables silent mode in phone options dialog -->
|
||||||
<string name="global_action_toggle_silent_mode">Silent mode</string>
|
<string name="global_action_toggle_silent_mode">Silent mode</string>
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ import android.content.IntentFilter;
|
|||||||
import android.content.pm.UserInfo;
|
import android.content.pm.UserInfo;
|
||||||
import android.database.ContentObserver;
|
import android.database.ContentObserver;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.graphics.drawable.ScaleDrawable;
|
|
||||||
import android.media.AudioManager;
|
import android.media.AudioManager;
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
@@ -45,7 +44,6 @@ import android.telephony.PhoneStateListener;
|
|||||||
import android.telephony.ServiceState;
|
import android.telephony.ServiceState;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Gravity;
|
|
||||||
import android.view.IWindowManager;
|
import android.view.IWindowManager;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -231,6 +229,50 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
|
|||||||
// next: airplane mode
|
// next: airplane mode
|
||||||
mItems.add(mAirplaneModeOn);
|
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
|
// last: silent mode
|
||||||
if (SHOW_SILENT_TOGGLE) {
|
if (SHOW_SILENT_TOGGLE) {
|
||||||
mItems.add(mSilentModeAction);
|
mItems.add(mSilentModeAction);
|
||||||
|
|||||||
Reference in New Issue
Block a user