Modify text in Apps & notifications settings.

- in Settings->Apps & notifications->Apps->[select app], update the
  header summary to installation status, and move the version text to
  the bottom of the page.
- updatd preference title from Apps to App info
- update preference title from Notifications to App notifications

Bug: 34977561
Test: make RunSettingsRoboTests
Change-Id: I97e9b81c739fb99eaca2cf45fb11f208ad6cd9ca
This commit is contained in:
Doris Ling
2017-02-15 15:42:30 -08:00
parent d72b6cc1e9
commit 015a50bef9
5 changed files with 90 additions and 8 deletions

View File

@@ -3322,7 +3322,7 @@
<!-- Applications settings screen, setting option summary for the user to go to the screen to manage installed applications -->
<string name="manageapplications_settings_summary">Manage and remove installed apps</string>
<!-- Applications settings title, on main settings screen. If clicked, the user is taken to a settings screen full of application settings-->
<string name="applications_settings">Apps</string>
<string name="applications_settings">App info</string>
<!-- Applications settings summary, on main settings screen. The summary for the "Applications" item on the main settings screen. Describes what settings are accessible from the "Applications" screen. -->
<string name="applications_settings_summary">Manage apps, set up quick launch shortcuts</string>
<!-- Applications settings screen heading. The header for the Application settings screen. -->
@@ -3473,6 +3473,8 @@
<string name="disabled">Disabled</string>
<!-- [CHAR LIMIT=30] Manage applications, text telling using an application is not installed for the current user. The key part is that it's not installed. -->
<string name="not_installed">Not installed for this user</string>
<!-- [CHAR LIMIT=30] App details, text telling an application is installed. -->
<string name="installed">Installed</string>
<!-- [CHAR LIMIT=25] Text shown when there are no applications to display. -->
<string name="no_applications">No apps.</string>
<!-- [CHAR LIMIT=15] Manage applications, label for chart showing internal storage use. -->
@@ -6289,7 +6291,7 @@
<string name="lock_screen_notifications_interstitial_title_profile">Profile notifications</string>
<!-- Notification Settings: Title for the option managing notifications per application. [CHAR LIMIT=30] -->
<string name="app_notifications_title">Notifications</string>
<string name="app_notifications_title">App notifications</string>
<!-- [CHAR LIMIT=100] Notification importance slider title -->
<string name="notification_importance_title">Importance</string>

View File

@@ -58,4 +58,9 @@
android:enabled="false"
android:selectable="true"/>
<Preference
android:key="app_version"
android:selectable="false"
android:order="9999"/>
</PreferenceScreen>

View File

@@ -151,6 +151,7 @@ public class InstalledAppDetails extends AppInfoBase
private static final String KEY_LAUNCH = "preferred_settings";
private static final String KEY_BATTERY = "battery";
private static final String KEY_MEMORY = "memory";
private static final String KEY_VERSION = "app_version";
private static final String NOTIFICATION_TUNER_SETTING = "show_importance_slider";
@@ -171,6 +172,7 @@ public class InstalledAppDetails extends AppInfoBase
private Preference mLaunchPreference;
private Preference mDataPreference;
private Preference mMemoryPreference;
private Preference mVersionPreference;
private boolean mDisableAfterUninstall;
@@ -416,6 +418,7 @@ public class InstalledAppDetails extends AppInfoBase
mBatteryPreference.setOnPreferenceClickListener(this);
mMemoryPreference = findPreference(KEY_MEMORY);
mMemoryPreference.setOnPreferenceClickListener(this);
mVersionPreference = findPreference(KEY_VERSION);
mLaunchPreference = findPreference(KEY_LAUNCH);
if (mAppEntry != null && mAppEntry.info != null) {
@@ -559,14 +562,23 @@ public class InstalledAppDetails extends AppInfoBase
.newAppHeaderController(this, appSnippet)
.setLabel(mAppEntry)
.setIcon(mAppEntry)
.setSummary(pkgInfo)
.setSummary(getString(getInstallationStatus(mAppEntry.info)))
.done(false /* rebindActions */);
mVersionPreference.setSummary(getString(R.string.version_text, pkgInfo.versionName));
} else {
setupAppSnippet(appSnippet, mAppEntry.label, mAppEntry.icon,
pkgInfo != null ? pkgInfo.versionName : null);
}
}
@VisibleForTesting
int getInstallationStatus(ApplicationInfo info) {
if ((info.flags & ApplicationInfo.FLAG_INSTALLED) == 0) {
return R.string.not_installed;
}
return info.enabled ? R.string.installed : R.string.disabled;
}
private boolean signaturesMatch(String pkg1, String pkg2) {
if (pkg1 != null && pkg2 != null) {
try {

View File

@@ -0,0 +1,63 @@
/*
* Copyright (C) 2017 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.settings.applications;
import android.content.pm.ApplicationInfo;
import com.android.settings.R;
import com.android.settings.SettingsRobolectricTestRunner;
import com.android.settings.TestConfig;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.annotation.Config;
import static com.google.common.truth.Truth.assertThat;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
public final class InstalledAppDetailsTest {
@Test
public void getInstallationStatus_notInstalled_shouldReturnUninstalled() {
final InstalledAppDetails mAppDetail = new InstalledAppDetails();
assertThat(mAppDetail.getInstallationStatus(new ApplicationInfo()))
.isEqualTo(R.string.not_installed);
}
@Test
public void getInstallationStatus_enabled_shouldReturnInstalled() {
final InstalledAppDetails mAppDetail = new InstalledAppDetails();
final ApplicationInfo info = new ApplicationInfo();
info.flags = ApplicationInfo.FLAG_INSTALLED;
info.enabled = true;
assertThat(mAppDetail.getInstallationStatus(info)).isEqualTo(R.string.installed);
}
@Test
public void getInstallationStatus_disabled_shouldReturnDisabled() {
final InstalledAppDetails mAppDetail = new InstalledAppDetails();
final ApplicationInfo info = new ApplicationInfo();
info.flags = ApplicationInfo.FLAG_INSTALLED;
info.enabled = false;
assertThat(mAppDetail.getInstallationStatus(info)).isEqualTo(R.string.disabled);
}
}

View File

@@ -241,9 +241,9 @@ public class DatabaseIndexingManagerTest {
// Data Rank
assertThat(cursor.getInt(1)).isEqualTo(rank);
// Data Title
assertThat(cursor.getString(2)).isEqualTo("Apps");
assertThat(cursor.getString(2)).isEqualTo("App info");
// Normalized Title
assertThat(cursor.getString(3)).isEqualTo("apps");
assertThat(cursor.getString(3)).isEqualTo("app info");
// Summary On
assertThat(cursor.getString(4)).isEqualTo("Manage apps, set up quick launch shortcuts");
// Summary On Normalized
@@ -257,7 +257,7 @@ public class DatabaseIndexingManagerTest {
// Keywords
assertThat(cursor.getString(9)).isEmpty();
// Screen Title
assertThat(cursor.getString(10)).isEqualTo("Apps");
assertThat(cursor.getString(10)).isEqualTo("App info");
// Class Name
assertThat(cursor.getString(11)).isEqualTo(className);
// Icon
@@ -395,7 +395,7 @@ public class DatabaseIndexingManagerTest {
// Keywords
assertThat(cursor.getString(9)).isEmpty();
// Screen Title
assertThat(cursor.getString(10)).isEqualTo("Apps");
assertThat(cursor.getString(10)).isEqualTo("App info");
// Class Name
assertThat(cursor.getString(11)).isEqualTo(className);
// Icon
@@ -450,7 +450,7 @@ public class DatabaseIndexingManagerTest {
// Keywords
assertThat(cursor.getString(9)).isEmpty();
// Screen Title
assertThat(cursor.getString(10)).isEqualTo("Apps");
assertThat(cursor.getString(10)).isEqualTo("App info");
// Class Name
assertThat(cursor.getString(11)).isEqualTo(className);
// Icon