Developer option to enable Terminal app.
Change-Id: I765b956381e4bdf0e315108c0e94e0b1c0d2cb86
This commit is contained in:
@@ -3036,6 +3036,11 @@
|
|||||||
<!-- Message of dialog confirming that user wants to protect external storage. [CHAR LIMIT=NONE] -->
|
<!-- Message of dialog confirming that user wants to protect external storage. [CHAR LIMIT=NONE] -->
|
||||||
<string name="enforce_read_external_confirm_message" product="default">When SD card is protected, apps must request permission to read data from external storage.\n\nSome apps may not work until updated by their developers.</string>
|
<string name="enforce_read_external_confirm_message" product="default">When SD card is protected, apps must request permission to read data from external storage.\n\nSome apps may not work until updated by their developers.</string>
|
||||||
|
|
||||||
|
<!-- Title of checkbox setting that enables the terminal app. [CHAR LIMIT=32] -->
|
||||||
|
<string name="enable_terminal_title">Local terminal</string>
|
||||||
|
<!-- Summary of checkbox setting that enables the terminal app. [CHAR LIMIT=64] -->
|
||||||
|
<string name="enable_terminal_summary">Enable terminal app that offers local shell access</string>
|
||||||
|
|
||||||
<!-- Title for the screen that lets the user choose a gadget to add to the home screen
|
<!-- Title for the screen that lets the user choose a gadget to add to the home screen
|
||||||
(or other screens that can host gadgets). Note to translators: we're still determining
|
(or other screens that can host gadgets). Note to translators: we're still determining
|
||||||
the final name for Gadgets/Widgets, so please translate both for now. -->
|
the final name for Gadgets/Widgets, so please translate both for now. -->
|
||||||
|
@@ -60,6 +60,11 @@
|
|||||||
<Preference android:key="clear_adb_keys"
|
<Preference android:key="clear_adb_keys"
|
||||||
android:title="@string/clear_adb_keys" />
|
android:title="@string/clear_adb_keys" />
|
||||||
|
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:key="enable_terminal"
|
||||||
|
android:title="@string/enable_terminal_title"
|
||||||
|
android:summary="@string/enable_terminal_summary" />
|
||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="bugreport_in_power"
|
android:key="bugreport_in_power"
|
||||||
android:title="@string/bugreport_in_power"
|
android:title="@string/bugreport_in_power"
|
||||||
|
@@ -88,6 +88,7 @@ public class DevelopmentSettings extends PreferenceFragment
|
|||||||
|
|
||||||
private static final String ENABLE_ADB = "enable_adb";
|
private static final String ENABLE_ADB = "enable_adb";
|
||||||
private static final String CLEAR_ADB_KEYS = "clear_adb_keys";
|
private static final String CLEAR_ADB_KEYS = "clear_adb_keys";
|
||||||
|
private static final String ENABLE_TERMINAL = "enable_terminal";
|
||||||
private static final String KEEP_SCREEN_ON = "keep_screen_on";
|
private static final String KEEP_SCREEN_ON = "keep_screen_on";
|
||||||
private static final String ALLOW_MOCK_LOCATION = "allow_mock_location";
|
private static final String ALLOW_MOCK_LOCATION = "allow_mock_location";
|
||||||
private static final String HDCP_CHECKING_KEY = "hdcp_checking";
|
private static final String HDCP_CHECKING_KEY = "hdcp_checking";
|
||||||
@@ -134,6 +135,8 @@ public class DevelopmentSettings extends PreferenceFragment
|
|||||||
|
|
||||||
private static final String PACKAGE_MIME_TYPE = "application/vnd.android.package-archive";
|
private static final String PACKAGE_MIME_TYPE = "application/vnd.android.package-archive";
|
||||||
|
|
||||||
|
private static final String TERMINAL_APP_PACKAGE = "com.android.terminal";
|
||||||
|
|
||||||
private static final int RESULT_DEBUG_APP = 1000;
|
private static final int RESULT_DEBUG_APP = 1000;
|
||||||
|
|
||||||
private IWindowManager mWindowManager;
|
private IWindowManager mWindowManager;
|
||||||
@@ -147,6 +150,7 @@ public class DevelopmentSettings extends PreferenceFragment
|
|||||||
|
|
||||||
private CheckBoxPreference mEnableAdb;
|
private CheckBoxPreference mEnableAdb;
|
||||||
private Preference mClearAdbKeys;
|
private Preference mClearAdbKeys;
|
||||||
|
private CheckBoxPreference mEnableTerminal;
|
||||||
private Preference mBugreport;
|
private Preference mBugreport;
|
||||||
private CheckBoxPreference mBugreportInPower;
|
private CheckBoxPreference mBugreportInPower;
|
||||||
private CheckBoxPreference mKeepScreenOn;
|
private CheckBoxPreference mKeepScreenOn;
|
||||||
@@ -216,6 +220,7 @@ public class DevelopmentSettings extends PreferenceFragment
|
|||||||
debugDebuggingCategory.removePreference(mClearAdbKeys);
|
debugDebuggingCategory.removePreference(mClearAdbKeys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mEnableTerminal = findAndInitCheckboxPref(ENABLE_TERMINAL);
|
||||||
|
|
||||||
mBugreport = findPreference(BUGREPORT);
|
mBugreport = findPreference(BUGREPORT);
|
||||||
mBugreportInPower = findAndInitCheckboxPref(BUGREPORT_IN_POWER_KEY);
|
mBugreportInPower = findAndInitCheckboxPref(BUGREPORT_IN_POWER_KEY);
|
||||||
@@ -228,6 +233,7 @@ public class DevelopmentSettings extends PreferenceFragment
|
|||||||
if (!android.os.Process.myUserHandle().equals(UserHandle.OWNER)) {
|
if (!android.os.Process.myUserHandle().equals(UserHandle.OWNER)) {
|
||||||
disableForUser(mEnableAdb);
|
disableForUser(mEnableAdb);
|
||||||
disableForUser(mClearAdbKeys);
|
disableForUser(mClearAdbKeys);
|
||||||
|
disableForUser(mEnableTerminal);
|
||||||
disableForUser(mPassword);
|
disableForUser(mPassword);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -402,6 +408,9 @@ public class DevelopmentSettings extends PreferenceFragment
|
|||||||
mHaveDebugSettings = false;
|
mHaveDebugSettings = false;
|
||||||
updateCheckBox(mEnableAdb, Settings.Global.getInt(cr,
|
updateCheckBox(mEnableAdb, Settings.Global.getInt(cr,
|
||||||
Settings.Global.ADB_ENABLED, 0) != 0);
|
Settings.Global.ADB_ENABLED, 0) != 0);
|
||||||
|
updateCheckBox(mEnableTerminal,
|
||||||
|
context.getPackageManager().getApplicationEnabledSetting(TERMINAL_APP_PACKAGE)
|
||||||
|
== PackageManager.COMPONENT_ENABLED_STATE_ENABLED);
|
||||||
updateCheckBox(mBugreportInPower, Settings.Secure.getInt(cr,
|
updateCheckBox(mBugreportInPower, Settings.Secure.getInt(cr,
|
||||||
Settings.Secure.BUGREPORT_IN_POWER_MENU, 0) != 0);
|
Settings.Secure.BUGREPORT_IN_POWER_MENU, 0) != 0);
|
||||||
updateCheckBox(mKeepScreenOn, Settings.Global.getInt(cr,
|
updateCheckBox(mKeepScreenOn, Settings.Global.getInt(cr,
|
||||||
@@ -1030,6 +1039,11 @@ public class DevelopmentSettings extends PreferenceFragment
|
|||||||
.setPositiveButton(android.R.string.ok, this)
|
.setPositiveButton(android.R.string.ok, this)
|
||||||
.setNegativeButton(android.R.string.cancel, null)
|
.setNegativeButton(android.R.string.cancel, null)
|
||||||
.show();
|
.show();
|
||||||
|
} else if (preference == mEnableTerminal) {
|
||||||
|
final PackageManager pm = getActivity().getPackageManager();
|
||||||
|
pm.setApplicationEnabledSetting(TERMINAL_APP_PACKAGE,
|
||||||
|
mEnableTerminal.isChecked() ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
|
||||||
|
: PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, 0);
|
||||||
} else if (preference == mBugreportInPower) {
|
} else if (preference == mBugreportInPower) {
|
||||||
Settings.Secure.putInt(getActivity().getContentResolver(),
|
Settings.Secure.putInt(getActivity().getContentResolver(),
|
||||||
Settings.Secure.BUGREPORT_IN_POWER_MENU,
|
Settings.Secure.BUGREPORT_IN_POWER_MENU,
|
||||||
|
Reference in New Issue
Block a user