From 28ec98cd1fdf23a7dd4d0c43346d08bc9b2e7656 Mon Sep 17 00:00:00 2001 From: Bartosz Fabianowski Date: Wed, 19 Apr 2017 11:51:43 +0200 Subject: [PATCH] Only show headers in Master Clear when there are multiple profiles The Master Clear dialog lists the accounts whose data will be lost by a factory reset. The list contains the headings "Personal" and "Work" to distinguish accounts in the main user and the work profile. When there is no work profile, the header (only "Personal" would be shown in this case) is superfluous and misleading (as the user may be using the device for work). Bug: 30132270 Test: Manual :( Change-Id: Id493652fc331d4500c4d772a9abcc716995565b3 (cherry picked from commit 30ba8680144a7978007511d4d9a3addbe9338284) --- src/com/android/settings/MasterClear.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/com/android/settings/MasterClear.java b/src/com/android/settings/MasterClear.java index fa9410d2db8..69f563e6932 100644 --- a/src/com/android/settings/MasterClear.java +++ b/src/com/android/settings/MasterClear.java @@ -284,11 +284,13 @@ public class MasterClear extends OptionsMenuFragment .getAuthenticatorTypesAsUser(profileId); final int M = descs.length; - View titleView = Utils.inflateCategoryHeader(inflater, contents); - final TextView titleText = (TextView) titleView.findViewById(android.R.id.title); - titleText.setText(userInfo.isManagedProfile() ? R.string.category_work - : R.string.category_personal); - contents.addView(titleView); + if (profilesSize > 1) { + View titleView = Utils.inflateCategoryHeader(inflater, contents); + final TextView titleText = (TextView) titleView.findViewById(android.R.id.title); + titleText.setText(userInfo.isManagedProfile() ? R.string.category_work + : R.string.category_personal); + contents.addView(titleView); + } for (int i = 0; i < N; i++) { Account account = accounts[i];