Merge "Update string description for CAR_TEST_SERVICE permisison" into qt-qpr1-dev
diff --git a/tests/CarDeveloperOptions/AndroidManifest.xml b/tests/CarDeveloperOptions/AndroidManifest.xml
index 5975572..046b386 100644
--- a/tests/CarDeveloperOptions/AndroidManifest.xml
+++ b/tests/CarDeveloperOptions/AndroidManifest.xml
@@ -21,7 +21,6 @@
<original-package android:name="com.android.car.developeroptions" />
<uses-permission android:name="android.permission.REQUEST_NETWORK_SCORES" />
- <uses-permission android:name="android.permission.WRITE_MEDIA_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
diff --git a/tests/CarDeveloperOptions/res/xml/development_settings.xml b/tests/CarDeveloperOptions/res/xml/development_settings.xml
index 9ed1285..a946526 100644
--- a/tests/CarDeveloperOptions/res/xml/development_settings.xml
+++ b/tests/CarDeveloperOptions/res/xml/development_settings.xml
@@ -30,11 +30,6 @@
android:summary="@string/summary_placeholder"
android:fragment="com.android.car.developeroptions.applications.ProcessStatsSummary" />
- <com.android.car.developeroptions.BugreportPreference
- android:key="bugreport"
- android:title="@*android:string/bugreport_title"
- android:dialogTitle="@*android:string/bugreport_title" />
-
<Preference
android:key="system_server_heap_dump"
android:title="@string/capture_system_heap_dump_title" />
@@ -151,11 +146,6 @@
android:summary="@string/enable_terminal_summary" />
<SwitchPreference
- android:key="bugreport_in_power"
- android:title="@string/bugreport_in_power"
- android:summary="@string/bugreport_in_power_summary" />
-
- <SwitchPreference
android:key="automatic_system_server_heap_dumps"
android:title="@string/automatic_system_heap_dump_title"
android:summary="@string/automatic_system_heap_dump_summary" />
diff --git a/tests/CarDeveloperOptions/src/com/android/car/developeroptions/BugreportPreference.java b/tests/CarDeveloperOptions/src/com/android/car/developeroptions/BugreportPreference.java
deleted file mode 100644
index 6acef70..0000000
--- a/tests/CarDeveloperOptions/src/com/android/car/developeroptions/BugreportPreference.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (C) 2019 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.car.developeroptions;
-
-import android.app.ActivityManager;
-import android.app.settings.SettingsEnums;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.os.RemoteException;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.View;
-import android.widget.CheckedTextView;
-import android.widget.TextView;
-
-import androidx.appcompat.app.AlertDialog.Builder;
-
-import com.android.car.developeroptions.overlay.FeatureFactory;
-import com.android.settingslib.CustomDialogPreferenceCompat;
-
-public class BugreportPreference extends CustomDialogPreferenceCompat {
-
- private static final String TAG = "BugreportPreference";
-
- private CheckedTextView mInteractiveTitle;
- private TextView mInteractiveSummary;
- private CheckedTextView mFullTitle;
- private TextView mFullSummary;
-
- public BugreportPreference(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-
- @Override
- protected void onPrepareDialogBuilder(Builder builder, DialogInterface.OnClickListener listener) {
- super.onPrepareDialogBuilder(builder, listener);
-
- final View dialogView = View.inflate(getContext(), R.layout.bugreport_options_dialog, null);
- mInteractiveTitle = (CheckedTextView) dialogView.findViewById(R.id.bugreport_option_interactive_title);
- mInteractiveSummary = (TextView) dialogView.findViewById(R.id.bugreport_option_interactive_summary);
- mFullTitle = (CheckedTextView) dialogView.findViewById(R.id.bugreport_option_full_title);
- mFullSummary = (TextView) dialogView.findViewById(R.id.bugreport_option_full_summary);
- final View.OnClickListener l = new View.OnClickListener() {
-
- @Override
- public void onClick(View v) {
- if (v == mFullTitle || v == mFullSummary) {
- mInteractiveTitle.setChecked(false);
- mFullTitle.setChecked(true);
- }
- if (v == mInteractiveTitle || v == mInteractiveSummary) {
- mInteractiveTitle.setChecked(true);
- mFullTitle.setChecked(false);
- }
- }
- };
- mInteractiveTitle.setOnClickListener(l);
- mFullTitle.setOnClickListener(l);
- mInteractiveSummary.setOnClickListener(l);
- mFullSummary.setOnClickListener(l);
-
- builder.setPositiveButton(com.android.internal.R.string.report, listener);
- builder.setView(dialogView);
- }
-
- @Override
- protected void onClick(DialogInterface dialog, int which) {
- if (which == DialogInterface.BUTTON_POSITIVE) {
-
- final Context context = getContext();
- if (mFullTitle.isChecked()) {
- Log.v(TAG, "Taking full bugreport right away");
- FeatureFactory.getFactory(context).getMetricsFeatureProvider().action(context,
- SettingsEnums.ACTION_BUGREPORT_FROM_SETTINGS_FULL);
- takeBugreport(ActivityManager.BUGREPORT_OPTION_FULL);
- } else {
- Log.v(TAG, "Taking interactive bugreport right away");
- FeatureFactory.getFactory(context).getMetricsFeatureProvider().action(context,
- SettingsEnums.ACTION_BUGREPORT_FROM_SETTINGS_INTERACTIVE);
- takeBugreport(ActivityManager.BUGREPORT_OPTION_INTERACTIVE);
- }
- }
- }
-
- private void takeBugreport(int bugreportType) {
- try {
- ActivityManager.getService().requestBugReport(bugreportType);
- } catch (RemoteException e) {
- Log.e(TAG, "error taking bugreport (bugreportType=" + bugreportType + ")", e);
- }
- }
-}
diff --git a/tests/CarDeveloperOptions/src/com/android/car/developeroptions/development/BugReportInPowerPreferenceController.java b/tests/CarDeveloperOptions/src/com/android/car/developeroptions/development/BugReportInPowerPreferenceController.java
deleted file mode 100644
index 1f22eb2..0000000
--- a/tests/CarDeveloperOptions/src/com/android/car/developeroptions/development/BugReportInPowerPreferenceController.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (C) 2019 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.car.developeroptions.development;
-
-import android.content.Context;
-import android.os.UserManager;
-import android.provider.Settings;
-
-import androidx.annotation.VisibleForTesting;
-import androidx.preference.Preference;
-import androidx.preference.SwitchPreference;
-
-import com.android.car.developeroptions.core.PreferenceControllerMixin;
-import com.android.settingslib.development.DeveloperOptionsPreferenceController;
-
-public class BugReportInPowerPreferenceController extends
- DeveloperOptionsPreferenceController implements Preference.OnPreferenceChangeListener,
- PreferenceControllerMixin {
-
- private static final String KEY_BUGREPORT_IN_POWER = "bugreport_in_power";
-
- @VisibleForTesting
- static int SETTING_VALUE_ON = 1;
- @VisibleForTesting
- static int SETTING_VALUE_OFF = 0;
-
- private final UserManager mUserManager;
-
- public BugReportInPowerPreferenceController(Context context) {
- super(context);
- mUserManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
- }
-
- @Override
- public boolean isAvailable() {
- return !mUserManager.hasUserRestriction(UserManager.DISALLOW_DEBUGGING_FEATURES);
- }
-
- @Override
- public String getPreferenceKey() {
- return KEY_BUGREPORT_IN_POWER;
- }
-
- @Override
- public boolean onPreferenceChange(Preference preference, Object newValue) {
- final boolean isEnabled = (Boolean) newValue;
- Settings.Secure.putInt(mContext.getContentResolver(),
- Settings.Global.BUGREPORT_IN_POWER_MENU,
- isEnabled ? SETTING_VALUE_ON : SETTING_VALUE_OFF);
- return true;
- }
-
- @Override
- public void updateState(Preference preference) {
- final int mode = Settings.Secure.getInt(mContext.getContentResolver(),
- Settings.Global.BUGREPORT_IN_POWER_MENU, SETTING_VALUE_OFF);
- ((SwitchPreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
- }
-
- @Override
- protected void onDeveloperOptionsSwitchDisabled() {
- super.onDeveloperOptionsSwitchDisabled();
- Settings.Secure.putInt(mContext.getContentResolver(),
- Settings.Global.BUGREPORT_IN_POWER_MENU, SETTING_VALUE_OFF);
- ((SwitchPreference) mPreference).setChecked(false);
- }
-}
diff --git a/tests/CarDeveloperOptions/src/com/android/car/developeroptions/development/BugReportPreferenceController.java b/tests/CarDeveloperOptions/src/com/android/car/developeroptions/development/BugReportPreferenceController.java
deleted file mode 100644
index 28fb9b5..0000000
--- a/tests/CarDeveloperOptions/src/com/android/car/developeroptions/development/BugReportPreferenceController.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2019 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.car.developeroptions.development;
-
-import android.content.Context;
-import android.os.UserManager;
-
-import com.android.car.developeroptions.core.PreferenceControllerMixin;
-import com.android.settingslib.development.DeveloperOptionsPreferenceController;
-
-public class BugReportPreferenceController extends DeveloperOptionsPreferenceController implements
- PreferenceControllerMixin {
-
- private static final String KEY_BUGREPORT = "bugreport";
-
- private final UserManager mUserManager;
-
- public BugReportPreferenceController(Context context) {
- super(context);
-
- mUserManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
- }
-
- @Override
- public boolean isAvailable() {
- return !mUserManager.hasUserRestriction(UserManager.DISALLOW_DEBUGGING_FEATURES);
- }
-
- @Override
- public String getPreferenceKey() {
- return KEY_BUGREPORT;
- }
-}
diff --git a/tests/CarDeveloperOptions/src/com/android/car/developeroptions/development/DevelopmentSettingsDashboardFragment.java b/tests/CarDeveloperOptions/src/com/android/car/developeroptions/development/DevelopmentSettingsDashboardFragment.java
index 95c8b6a..3253d21 100644
--- a/tests/CarDeveloperOptions/src/com/android/car/developeroptions/development/DevelopmentSettingsDashboardFragment.java
+++ b/tests/CarDeveloperOptions/src/com/android/car/developeroptions/development/DevelopmentSettingsDashboardFragment.java
@@ -403,7 +403,6 @@
BluetoothA2dpConfigStore bluetoothA2dpConfigStore) {
final List<AbstractPreferenceController> controllers = new ArrayList<>();
controllers.add(new MemoryUsagePreferenceController(context));
- controllers.add(new BugReportPreferenceController(context));
controllers.add(new SystemServerHeapDumpPreferenceController(context));
controllers.add(new LocalBackupPasswordPreferenceController(context));
controllers.add(new StayAwakePreferenceController(context, lifecycle));
@@ -418,7 +417,6 @@
controllers.add(new AdbPreferenceController(context, fragment));
controllers.add(new ClearAdbKeysPreferenceController(context, fragment));
controllers.add(new LocalTerminalPreferenceController(context));
- controllers.add(new BugReportInPowerPreferenceController(context));
controllers.add(new AutomaticSystemServerHeapDumpPreferenceController(context));
controllers.add(new MockLocationAppPreferenceController(context, fragment));
controllers.add(new DebugViewAttributesPreferenceController(context));