From 73bc4703739639d823abb743515836d4f55799c1 Mon Sep 17 00:00:00 2001 From: zachh Date: Tue, 31 Oct 2017 12:35:00 -0700 Subject: Use unencrypted storage for shared prefs in new call log. We need to be able to write the shared prefs when the device is in direct boot mode, and this data is not sensitive so can be unencrypted. Bug: 68350256 Test: existing unit, manual PiperOrigin-RevId: 174075154 Change-Id: Ib52e11c6abba0812d1dc07c642691359089c3e6e --- .../android/dialer/storage/DeviceProtected.java | 22 ---------------------- .../android/dialer/storage/StorageComponent.java | 4 ++++ java/com/android/dialer/storage/StorageModule.java | 1 + java/com/android/dialer/storage/Unencrypted.java | 22 ++++++++++++++++++++++ 4 files changed, 27 insertions(+), 22 deletions(-) delete mode 100644 java/com/android/dialer/storage/DeviceProtected.java create mode 100644 java/com/android/dialer/storage/Unencrypted.java (limited to 'java/com/android/dialer/storage') diff --git a/java/com/android/dialer/storage/DeviceProtected.java b/java/com/android/dialer/storage/DeviceProtected.java deleted file mode 100644 index 862259a61..000000000 --- a/java/com/android/dialer/storage/DeviceProtected.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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.dialer.storage; - -import javax.inject.Qualifier; - -/** Annotation for retrieving device protected storage objects. */ -@Qualifier -public @interface DeviceProtected {} diff --git a/java/com/android/dialer/storage/StorageComponent.java b/java/com/android/dialer/storage/StorageComponent.java index 067b99424..cb5c4a879 100644 --- a/java/com/android/dialer/storage/StorageComponent.java +++ b/java/com/android/dialer/storage/StorageComponent.java @@ -28,7 +28,11 @@ public abstract class StorageComponent { /** * Returns unencrypted default shared preferences. This method should not be used for private * data. + * + *

These shared prefs are available even when the device is in FBE mode and are generally the + * ones that should be used, because Dialer needs to function while in FBE mode. */ + @Unencrypted public abstract SharedPreferences unencryptedSharedPrefs(); public static StorageComponent get(Context context) { diff --git a/java/com/android/dialer/storage/StorageModule.java b/java/com/android/dialer/storage/StorageModule.java index 3ee72c8d8..e1c5b4b08 100644 --- a/java/com/android/dialer/storage/StorageModule.java +++ b/java/com/android/dialer/storage/StorageModule.java @@ -30,6 +30,7 @@ public class StorageModule { @Provides @Singleton + @Unencrypted static SharedPreferences provideUnencryptedSharedPrefs(@ApplicationContext Context appContext) { // #createDeviceProtectedStorageContext returns a new context each time, so we cache the shared // preferences object in order to avoid accessing disk for every operation. diff --git a/java/com/android/dialer/storage/Unencrypted.java b/java/com/android/dialer/storage/Unencrypted.java new file mode 100644 index 000000000..02c902145 --- /dev/null +++ b/java/com/android/dialer/storage/Unencrypted.java @@ -0,0 +1,22 @@ +/* + * 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.dialer.storage; + +import javax.inject.Qualifier; + +/** Annotation for retrieving unencrypted storage objects. */ +@Qualifier +public @interface Unencrypted {} -- cgit v1.2.3