commit | 325b033f8542b79b7474413dabf83986d749c4b7 | [log] [tgz] |
---|---|---|
author | Treehugger Robot <treehugger-gerrit@google.com> | Thu Sep 15 12:16:23 2022 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Thu Sep 15 12:16:23 2022 +0000 |
tree | 081b3c50a6f6c0320a27f310393bb9e75fd5bc7f | |
parent | ca3213bf8815b12b9a30c75f51912e904981ede3 [diff] | |
parent | 0960af0bf3ce0a284e317df2cfc57408e561d06d [diff] |
Merge "Mark DataUsageState as nullable to avoid potential NPE risk" am: 0960af0bf3 Original change: https://android-review.googlesource.com/c/platform/packages/apps/Settings/+/2217422 Change-Id: I459cae5f473576dd3d9c4f8ee6fa9e7f5581ad75 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/src/com/android/settings/datausage/UnrestrictedDataAccessPreference.java b/src/com/android/settings/datausage/UnrestrictedDataAccessPreference.java index 08e523c..1fea84c 100644 --- a/src/com/android/settings/datausage/UnrestrictedDataAccessPreference.java +++ b/src/com/android/settings/datausage/UnrestrictedDataAccessPreference.java
@@ -20,6 +20,7 @@ import android.os.UserHandle; import android.view.View; +import androidx.annotation.Nullable; import androidx.preference.PreferenceViewHolder; import com.android.settings.R; @@ -152,6 +153,7 @@ } } + @Nullable public AppStateDataUsageBridge.DataUsageState getDataUsageState() { return mDataUsageState; }
diff --git a/src/com/android/settings/datausage/UnrestrictedDataAccessPreferenceController.java b/src/com/android/settings/datausage/UnrestrictedDataAccessPreferenceController.java index 06cf8ed..438ed0d 100644 --- a/src/com/android/settings/datausage/UnrestrictedDataAccessPreferenceController.java +++ b/src/com/android/settings/datausage/UnrestrictedDataAccessPreferenceController.java
@@ -194,7 +194,9 @@ logSpecialPermissionChange(allowlisted, accessPreference.getEntry().info.packageName); mDataSaverBackend.setIsAllowlisted(accessPreference.getEntry().info.uid, accessPreference.getEntry().info.packageName, allowlisted); - accessPreference.getDataUsageState().isDataSaverAllowlisted = allowlisted; + if (accessPreference.getDataUsageState() != null) { + accessPreference.getDataUsageState().isDataSaverAllowlisted = allowlisted; + } return true; } return false;