summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Songchun Fan <schfan@google.com> 2021-09-01 16:09:08 -0700
committer Songchun Fan <schfan@google.com> 2021-09-01 16:40:06 -0700
commit9ee3eebb99a67200979ca073dbbac8adba0a100d (patch)
tree1daf1e71a87663f669da5de6080ae481763f9eda
parent07678d1f45c7d1e3b15bcb66185d50d42234e776 (diff)
[SettingsProvider] additional logging for debug telephony bug
For the past few months we have been seening a telephony bug that happens occasionally without a reliable way to reproduce it. The bug is that for some reason, all of a sudden, the telephony thinks that the device is unprovisioned, even though the device is provisioned. Based on initial inspection, the inconsistency is from Settings Provider. However, the dumpsys shows that the DEVICE_PROVISIONED value is 1, and no other clients have reported this issue. The inconsistency could be from memory corruption, though that would probably have been reported by other clients as well. To further assist debugging, I am adding additional logging just for the query on DEVICE_PROVISIONED. This will at least show what exactly is the value returned to telephony, when the bug occurs again. I will remove the additional logging as soon as we have some clue. BUG: 197879371 Test: builds Change-Id: I1321168081fa808dca4503b84d58983df145e790
-rw-r--r--core/java/android/provider/Settings.java20
1 files changed, 19 insertions, 1 deletions
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 7a2898a7cf57..db9e40338760 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -15463,9 +15463,27 @@ public final class Settings {
*/
public static int getInt(ContentResolver cr, String name, int def) {
String v = getString(cr, name);
+ final boolean isQueryForDeviceProvision = name.equals(DEVICE_PROVISIONED);
try {
- return v != null ? Integer.parseInt(v) : def;
+ // TODO(b/197879371): remove the extra logging after bug is fixed
+ final int result;
+ if (v != null) {
+ result = Integer.parseInt(v);
+ if (isQueryForDeviceProvision) {
+ Log.w(TAG, "Found settings value for provision. Returning " + result);
+ }
+ } else {
+ result = def;
+ if (isQueryForDeviceProvision) {
+ Log.w(TAG, "Missing settings value for provision. Returning " + result);
+ }
+ }
+ return result;
} catch (NumberFormatException e) {
+ if (isQueryForDeviceProvision) {
+ Log.w(TAG, "Wrong settings value for provision. Found: " + v
+ + ". Returning " + v);
+ }
return def;
}
}