Loading AndroidManifest.xml +5 −5 Original line number Original line Diff line number Diff line Loading @@ -48,7 +48,7 @@ <provider android:name=".provider.ClockProvider" <provider android:name=".provider.ClockProvider" android:authorities="com.android.deskclock" android:authorities="com.android.deskclock" android:exported="false" android:exported="false" android:encryptionAware="true" /> android:directBootAware="true" /> <activity android:name="DeskClock" <activity android:name="DeskClock" android:label="@string/app_label" android:label="@string/app_label" Loading Loading @@ -105,7 +105,7 @@ android:theme="@style/AlarmAlertFullScreenTheme" android:theme="@style/AlarmAlertFullScreenTheme" android:windowSoftInputMode="stateAlwaysHidden" android:windowSoftInputMode="stateAlwaysHidden" android:showOnLockScreen="true" android:showOnLockScreen="true" android:encryptionAware="true" /> android:directBootAware="true" /> <activity android:name="ScreensaverActivity" <activity android:name="ScreensaverActivity" android:excludeFromRecents="true" android:excludeFromRecents="true" Loading @@ -115,12 +115,12 @@ <receiver android:name=".alarms.AlarmStateManager" <receiver android:name=".alarms.AlarmStateManager" android:exported="false" android:exported="false" android:encryptionAware="true"> android:directBootAware="true"> </receiver> </receiver> <service android:name=".alarms.AlarmService" <service android:name=".alarms.AlarmService" android:exported="false" android:exported="false" android:encryptionAware="true"> android:directBootAware="true"> </service> </service> <activity android:name="HandleApiCalls" <activity android:name="HandleApiCalls" Loading Loading @@ -235,7 +235,7 @@ </activity> </activity> <receiver android:name="AlarmInitReceiver" <receiver android:name="AlarmInitReceiver" android:encryptionAware="true"> android:directBootAware="true"> <intent-filter> <intent-filter> <action android:name="android.intent.action.LOCKED_BOOT_COMPLETED" /> <action android:name="android.intent.action.LOCKED_BOOT_COMPLETED" /> <action android:name="android.intent.action.BOOT_COMPLETED" /> <action android:name="android.intent.action.BOOT_COMPLETED" /> Loading src/com/android/deskclock/DeskClockBackupAgent.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -85,7 +85,7 @@ public class DeskClockBackupAgent extends BackupAgent { public void onRestoreFinished() { public void onRestoreFinished() { if (Utils.isNOrLater()) { if (Utils.isNOrLater()) { // TODO: migrate restored database and preferences over into // TODO: migrate restored database and preferences over into // the device-encrypted storage area // the device-protected storage area } } // Write a preference to indicate a data restore has been completed. // Write a preference to indicate a data restore has been completed. Loading src/com/android/deskclock/Utils.java +3 −3 Original line number Original line Diff line number Diff line Loading @@ -709,10 +709,10 @@ public class Utils { final Context storageContext; final Context storageContext; if (isNOrLater()) { if (isNOrLater()) { // All N devices have split storage areas, but we may need to // All N devices have split storage areas, but we may need to // migrate existing preferences into the new device encrypted // migrate existing preferences into the new device protected // storage area, which is where our data lives from now on. // storage area, which is where our data lives from now on. final Context deviceContext = context.createDeviceEncryptedStorageContext(); final Context deviceContext = context.createDeviceProtectedStorageContext(); if (!deviceContext.migrateSharedPreferencesFrom(context, if (!deviceContext.moveSharedPreferencesFrom(context, PreferenceManager.getDefaultSharedPreferencesName(context))) { PreferenceManager.getDefaultSharedPreferencesName(context))) { LogUtils.wtf("Failed to migrate shared preferences"); LogUtils.wtf("Failed to migrate shared preferences"); } } Loading src/com/android/deskclock/provider/ClockProvider.java +9 −10 Original line number Original line Diff line number Diff line /* /* * Copyright (C) 2013 The Android Open Source Project e * Copyright (C) 2013 The Android Open Source Project * * * Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License. Loading @@ -16,6 +16,9 @@ package com.android.deskclock.provider; package com.android.deskclock.provider; import static com.android.deskclock.provider.ClockDatabaseHelper.ALARMS_TABLE_NAME; import static com.android.deskclock.provider.ClockDatabaseHelper.INSTANCES_TABLE_NAME; import android.content.ContentProvider; import android.content.ContentProvider; import android.content.ContentResolver; import android.content.ContentResolver; import android.content.ContentUris; import android.content.ContentUris; Loading @@ -26,20 +29,16 @@ import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteQueryBuilder; import android.database.sqlite.SQLiteQueryBuilder; import android.net.Uri; import android.net.Uri; import android.preference.PreferenceManager; import android.text.TextUtils; import android.text.TextUtils; import android.util.ArrayMap; import android.util.ArrayMap; import com.android.deskclock.LogUtils; import com.android.deskclock.LogUtils; import com.android.deskclock.Utils; import com.android.deskclock.Utils; import com.android.deskclock.provider.ClockContract.AlarmsColumns; import com.android.deskclock.provider.ClockContract.InstancesColumns; import java.util.Map; import java.util.Map; import static com.android.deskclock.provider.ClockContract.AlarmsColumns; import static com.android.deskclock.provider.ClockContract.InstancesColumns; import static com.android.deskclock.provider.ClockDatabaseHelper.ALARMS_TABLE_NAME; import static com.android.deskclock.provider.ClockDatabaseHelper.INSTANCES_TABLE_NAME; public class ClockProvider extends ContentProvider { public class ClockProvider extends ContentProvider { private ClockDatabaseHelper mOpenHelper; private ClockDatabaseHelper mOpenHelper; Loading Loading @@ -122,10 +121,10 @@ public class ClockProvider extends ContentProvider { final Context storageContext; final Context storageContext; if (Utils.isNOrLater()) { if (Utils.isNOrLater()) { // All N devices have split storage areas, but we may need to // All N devices have split storage areas, but we may need to // migrate existing database into the new device encrypted // migrate existing database into the new device protected // storage area, which is where our data lives from now on. // storage area, which is where our data lives from now on. final Context deviceContext = context.createDeviceEncryptedStorageContext(); final Context deviceContext = context.createDeviceProtectedStorageContext(); if (!deviceContext.migrateDatabaseFrom(context, ClockDatabaseHelper.DATABASE_NAME)) { if (!deviceContext.moveDatabaseFrom(context, ClockDatabaseHelper.DATABASE_NAME)) { LogUtils.wtf("Failed to migrate database"); LogUtils.wtf("Failed to migrate database"); } } storageContext = deviceContext; storageContext = deviceContext; Loading Loading
AndroidManifest.xml +5 −5 Original line number Original line Diff line number Diff line Loading @@ -48,7 +48,7 @@ <provider android:name=".provider.ClockProvider" <provider android:name=".provider.ClockProvider" android:authorities="com.android.deskclock" android:authorities="com.android.deskclock" android:exported="false" android:exported="false" android:encryptionAware="true" /> android:directBootAware="true" /> <activity android:name="DeskClock" <activity android:name="DeskClock" android:label="@string/app_label" android:label="@string/app_label" Loading Loading @@ -105,7 +105,7 @@ android:theme="@style/AlarmAlertFullScreenTheme" android:theme="@style/AlarmAlertFullScreenTheme" android:windowSoftInputMode="stateAlwaysHidden" android:windowSoftInputMode="stateAlwaysHidden" android:showOnLockScreen="true" android:showOnLockScreen="true" android:encryptionAware="true" /> android:directBootAware="true" /> <activity android:name="ScreensaverActivity" <activity android:name="ScreensaverActivity" android:excludeFromRecents="true" android:excludeFromRecents="true" Loading @@ -115,12 +115,12 @@ <receiver android:name=".alarms.AlarmStateManager" <receiver android:name=".alarms.AlarmStateManager" android:exported="false" android:exported="false" android:encryptionAware="true"> android:directBootAware="true"> </receiver> </receiver> <service android:name=".alarms.AlarmService" <service android:name=".alarms.AlarmService" android:exported="false" android:exported="false" android:encryptionAware="true"> android:directBootAware="true"> </service> </service> <activity android:name="HandleApiCalls" <activity android:name="HandleApiCalls" Loading Loading @@ -235,7 +235,7 @@ </activity> </activity> <receiver android:name="AlarmInitReceiver" <receiver android:name="AlarmInitReceiver" android:encryptionAware="true"> android:directBootAware="true"> <intent-filter> <intent-filter> <action android:name="android.intent.action.LOCKED_BOOT_COMPLETED" /> <action android:name="android.intent.action.LOCKED_BOOT_COMPLETED" /> <action android:name="android.intent.action.BOOT_COMPLETED" /> <action android:name="android.intent.action.BOOT_COMPLETED" /> Loading
src/com/android/deskclock/DeskClockBackupAgent.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -85,7 +85,7 @@ public class DeskClockBackupAgent extends BackupAgent { public void onRestoreFinished() { public void onRestoreFinished() { if (Utils.isNOrLater()) { if (Utils.isNOrLater()) { // TODO: migrate restored database and preferences over into // TODO: migrate restored database and preferences over into // the device-encrypted storage area // the device-protected storage area } } // Write a preference to indicate a data restore has been completed. // Write a preference to indicate a data restore has been completed. Loading
src/com/android/deskclock/Utils.java +3 −3 Original line number Original line Diff line number Diff line Loading @@ -709,10 +709,10 @@ public class Utils { final Context storageContext; final Context storageContext; if (isNOrLater()) { if (isNOrLater()) { // All N devices have split storage areas, but we may need to // All N devices have split storage areas, but we may need to // migrate existing preferences into the new device encrypted // migrate existing preferences into the new device protected // storage area, which is where our data lives from now on. // storage area, which is where our data lives from now on. final Context deviceContext = context.createDeviceEncryptedStorageContext(); final Context deviceContext = context.createDeviceProtectedStorageContext(); if (!deviceContext.migrateSharedPreferencesFrom(context, if (!deviceContext.moveSharedPreferencesFrom(context, PreferenceManager.getDefaultSharedPreferencesName(context))) { PreferenceManager.getDefaultSharedPreferencesName(context))) { LogUtils.wtf("Failed to migrate shared preferences"); LogUtils.wtf("Failed to migrate shared preferences"); } } Loading
src/com/android/deskclock/provider/ClockProvider.java +9 −10 Original line number Original line Diff line number Diff line /* /* * Copyright (C) 2013 The Android Open Source Project e * Copyright (C) 2013 The Android Open Source Project * * * Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License. Loading @@ -16,6 +16,9 @@ package com.android.deskclock.provider; package com.android.deskclock.provider; import static com.android.deskclock.provider.ClockDatabaseHelper.ALARMS_TABLE_NAME; import static com.android.deskclock.provider.ClockDatabaseHelper.INSTANCES_TABLE_NAME; import android.content.ContentProvider; import android.content.ContentProvider; import android.content.ContentResolver; import android.content.ContentResolver; import android.content.ContentUris; import android.content.ContentUris; Loading @@ -26,20 +29,16 @@ import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteQueryBuilder; import android.database.sqlite.SQLiteQueryBuilder; import android.net.Uri; import android.net.Uri; import android.preference.PreferenceManager; import android.text.TextUtils; import android.text.TextUtils; import android.util.ArrayMap; import android.util.ArrayMap; import com.android.deskclock.LogUtils; import com.android.deskclock.LogUtils; import com.android.deskclock.Utils; import com.android.deskclock.Utils; import com.android.deskclock.provider.ClockContract.AlarmsColumns; import com.android.deskclock.provider.ClockContract.InstancesColumns; import java.util.Map; import java.util.Map; import static com.android.deskclock.provider.ClockContract.AlarmsColumns; import static com.android.deskclock.provider.ClockContract.InstancesColumns; import static com.android.deskclock.provider.ClockDatabaseHelper.ALARMS_TABLE_NAME; import static com.android.deskclock.provider.ClockDatabaseHelper.INSTANCES_TABLE_NAME; public class ClockProvider extends ContentProvider { public class ClockProvider extends ContentProvider { private ClockDatabaseHelper mOpenHelper; private ClockDatabaseHelper mOpenHelper; Loading Loading @@ -122,10 +121,10 @@ public class ClockProvider extends ContentProvider { final Context storageContext; final Context storageContext; if (Utils.isNOrLater()) { if (Utils.isNOrLater()) { // All N devices have split storage areas, but we may need to // All N devices have split storage areas, but we may need to // migrate existing database into the new device encrypted // migrate existing database into the new device protected // storage area, which is where our data lives from now on. // storage area, which is where our data lives from now on. final Context deviceContext = context.createDeviceEncryptedStorageContext(); final Context deviceContext = context.createDeviceProtectedStorageContext(); if (!deviceContext.migrateDatabaseFrom(context, ClockDatabaseHelper.DATABASE_NAME)) { if (!deviceContext.moveDatabaseFrom(context, ClockDatabaseHelper.DATABASE_NAME)) { LogUtils.wtf("Failed to migrate database"); LogUtils.wtf("Failed to migrate database"); } } storageContext = deviceContext; storageContext = deviceContext; Loading