Skip to content

Commit f6f7f1d

Browse files
committed
Low disk space string change, surface state.
Surface current low disk state through IPackageManager for use in Settings app. Bug: 6576409 Change-Id: I9ae9ce99a2faa3015a237036c03567d1ae11628f
1 parent fdcac45 commit f6f7f1d

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

core/java/android/content/pm/IPackageManager.aidl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,4 +376,7 @@ interface IPackageManager {
376376

377377
void setPermissionEnforced(String permission, boolean enforced);
378378
boolean isPermissionEnforced(String permission);
379+
380+
/** Reflects current DeviceStorageMonitorService state */
381+
boolean isStorageLow();
379382
}

core/res/res/values/strings.xml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2705,11 +2705,9 @@
27052705
<string name="editTextMenuTitle">Text actions</string>
27062706

27072707
<!-- If the device is getting low on internal storage, a notification is shown to the user. This is the title of that notification. -->
2708-
<string name="low_internal_storage_view_title">Low on space</string>
2708+
<string name="low_internal_storage_view_title">Storage space running out</string>
27092709
<!-- If the device is getting low on internal storage, a notification is shown to the user. This is the message of that notification. -->
2710-
<string name="low_internal_storage_view_text" product="tablet">Tablet storage space is getting low.</string>
2711-
<!-- If the device is getting low on internal storage, a notification is shown to the user. This is the message of that notification. -->
2712-
<string name="low_internal_storage_view_text" product="default">Phone storage space is getting low.</string>
2710+
<string name="low_internal_storage_view_text">Some system functions may not work</string>
27132711

27142712
<!-- Preference framework strings. -->
27152713
<string name="ok">OK</string>

services/java/com/android/server/pm/PackageManagerService.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9397,4 +9397,15 @@ private boolean isPermissionEnforcedLocked(String permission) {
93979397
return true;
93989398
}
93999399
}
9400+
9401+
public boolean isStorageLow() {
9402+
final long token = Binder.clearCallingIdentity();
9403+
try {
9404+
final DeviceStorageMonitorService dsm = (DeviceStorageMonitorService) ServiceManager
9405+
.getService(DeviceStorageMonitorService.SERVICE);
9406+
return dsm.isMemoryLow();
9407+
} finally {
9408+
Binder.restoreCallingIdentity(token);
9409+
}
9410+
}
94009411
}

0 commit comments

Comments
 (0)