• R/O
  • HTTP
  • SSH
  • HTTPS

提交

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

packages/apps/Settings


Commit MetaInfo

修訂166273d36cd9a5e2a2bace4729e64992e41896ed (tree)
時間2017-06-23 16:12:23
作者android-build-team Robot <android-build-team-robot@goog...>
Commiterandroid-build-team Robot

Log Message

release-request-160c4b31-7fa0-4e2b-aabe-85380836a1ce-for-git_oc-release-4129081 snap-temp-L15300000077039010

Change-Id: Ie605d70e3ef05f335e2fe025af5640300688d3e3

Change Summary

差異

--- a/src/com/android/settings/bluetooth/BluetoothPairingService.java
+++ b/src/com/android/settings/bluetooth/BluetoothPairingService.java
@@ -120,7 +120,8 @@ public final class BluetoothPairingService extends Service {
120120 Notification.Builder builder = new Notification.Builder(this,
121121 BLUETOOTH_NOTIFICATION_CHANNEL)
122122 .setSmallIcon(android.R.drawable.stat_sys_data_bluetooth)
123- .setTicker(res.getString(R.string.bluetooth_notif_ticker));
123+ .setTicker(res.getString(R.string.bluetooth_notif_ticker))
124+ .setLocalOnly(true);
124125
125126 PendingIntent pairIntent = PendingIntent.getActivity(this, 0,
126127 getPairingDialogIntent(this, intent), PendingIntent.FLAG_ONE_SHOT);
--- a/src/com/android/settings/bluetooth/BluetoothPermissionRequest.java
+++ b/src/com/android/settings/bluetooth/BluetoothPermissionRequest.java
@@ -181,6 +181,7 @@ public final class BluetoothPermissionRequest extends BroadcastReceiver {
181181 .setDeleteIntent(PendingIntent.getBroadcast(context, 0, deleteIntent, 0))
182182 .setColor(context.getColor(
183183 com.android.internal.R.color.system_notification_accent_color))
184+ .setLocalOnly(true)
184185 .build();
185186
186187 notification.flags |= Notification.FLAG_NO_CLEAR; // Cannot be set with the builder.
--- a/src/com/android/settings/deviceinfo/storage/StorageAsyncLoader.java
+++ b/src/com/android/settings/deviceinfo/storage/StorageAsyncLoader.java
@@ -105,7 +105,17 @@ public class StorageAsyncLoader
105105 continue;
106106 }
107107
108- long blamedSize = stats.getDataBytes() - stats.getCacheBytes();
108+ final long dataSize = stats.getDataBytes();
109+ final long cacheQuota = mStatsManager.getCacheQuotaBytes(mUuid, app.uid);
110+ final long cacheBytes = stats.getCacheBytes();
111+ long blamedSize = dataSize;
112+ // Technically, we could overages as freeable on the storage settings screen.
113+ // If the app is using more cache than its quota, we would accidentally subtract the
114+ // overage from the system size (because it shows up as unused) during our attribution.
115+ // Thus, we cap the attribution at the quota size.
116+ if (cacheQuota < cacheBytes) {
117+ blamedSize = blamedSize - cacheBytes + cacheQuota;
118+ }
109119
110120 // This isn't quite right because it slams the first user by user id with the whole code
111121 // size, but this ensures that we count all apps seen once.
--- a/tests/unit/src/com/android/settings/deviceinfo/storage/StorageAsyncLoaderTest.java
+++ b/tests/unit/src/com/android/settings/deviceinfo/storage/StorageAsyncLoaderTest.java
@@ -29,6 +29,7 @@ import android.content.Context;
2929 import android.content.pm.ApplicationInfo;
3030 import android.content.pm.PackageManager.NameNotFoundException;
3131 import android.content.pm.UserInfo;
32+import android.net.TrafficStats;
3233 import android.os.UserHandle;
3334 import android.support.test.filters.SmallTest;
3435 import android.support.test.runner.AndroidJUnit4;
@@ -55,6 +56,7 @@ public class StorageAsyncLoaderTest {
5556 private static final int SECONDARY_USER_ID = 10;
5657 private static final String PACKAGE_NAME_1 = "com.blah.test";
5758 private static final String PACKAGE_NAME_2 = "com.blah.test2";
59+ private static final long DEFAULT_QUOTA = 64 * TrafficStats.MB_IN_BYTES;
5860
5961 @Mock
6062 private StorageStatsSource mSource;
@@ -81,6 +83,7 @@ public class StorageAsyncLoaderTest {
8183 mUsers = new ArrayList<>();
8284 mUsers.add(info);
8385 when(mUserManager.getUsers()).thenReturn(mUsers);
86+ when(mSource.getCacheQuotaBytes(anyString(), anyInt())).thenReturn(DEFAULT_QUOTA);
8487 }
8588
8689 @Test
@@ -120,13 +123,13 @@ public class StorageAsyncLoaderTest {
120123 }
121124
122125 @Test
123- public void testCacheIsIgnored() throws Exception {
126+ public void testCacheIsNotIgnored() throws Exception {
124127 addPackage(PACKAGE_NAME_1, 100, 1, 10, ApplicationInfo.CATEGORY_UNDEFINED);
125128
126129 SparseArray<StorageAsyncLoader.AppsStorageResult> result = mLoader.loadInBackground();
127130
128131 assertThat(result.size()).isEqualTo(1);
129- assertThat(result.get(PRIMARY_USER_ID).otherAppsSize).isEqualTo(11L);
132+ assertThat(result.get(PRIMARY_USER_ID).otherAppsSize).isEqualTo(111L);
130133 }
131134
132135 @Test
@@ -155,7 +158,7 @@ public class StorageAsyncLoaderTest {
155158 SparseArray<StorageAsyncLoader.AppsStorageResult> result = mLoader.loadInBackground();
156159
157160 assertThat(result.size()).isEqualTo(1);
158- assertThat(result.get(PRIMARY_USER_ID).otherAppsSize).isEqualTo(11L);
161+ assertThat(result.get(PRIMARY_USER_ID).otherAppsSize).isEqualTo(111L);
159162 }
160163
161164 @Test
@@ -207,12 +210,23 @@ public class StorageAsyncLoaderTest {
207210 assertThat(result.get(SECONDARY_USER_ID).videoAppsSize).isEqualTo(10L);
208211 }
209212
213+ @Test
214+ public void testCacheOveragesAreCountedAsFree() throws Exception {
215+ addPackage(PACKAGE_NAME_1, DEFAULT_QUOTA + 100, 1, 10, ApplicationInfo.CATEGORY_UNDEFINED);
216+
217+ SparseArray<StorageAsyncLoader.AppsStorageResult> result = mLoader.loadInBackground();
218+
219+ assertThat(result.size()).isEqualTo(1);
220+ assertThat(result.get(PRIMARY_USER_ID).otherAppsSize).isEqualTo(DEFAULT_QUOTA + 11);
221+ }
222+
210223 private ApplicationInfo addPackage(String packageName, long cacheSize, long codeSize,
211224 long dataSize, int category) throws Exception {
212225 StorageStatsSource.AppStorageStats storageStats =
213226 mock(StorageStatsSource.AppStorageStats.class);
214227 when(storageStats.getCodeBytes()).thenReturn(codeSize);
215- when(storageStats.getDataBytes()).thenReturn(dataSize);
228+ when(storageStats.getDataBytes()).thenReturn(dataSize + cacheSize);
229+ when(storageStats.getCacheBytes()).thenReturn(cacheSize);
216230 when(mSource.getStatsForPackage(anyString(), eq(packageName), any(UserHandle.class)))
217231 .thenReturn(storageStats);
218232