From 35ea80ec66daa4df6e77766571c29a651c4db8f0 Mon Sep 17 00:00:00 2001 From: Liana Kazanova Date: Thu, 6 Apr 2023 23:01:18 +0000 Subject: Revert "Adds a reciever for pin migration data" Revert submission 22119004-b223249318-chooser-pin-migrate Reason for revert: Reverted changes: /q/submissionid:22119004-b223249318-chooser-pin-migrate Change-Id: I17b20318a401e9942f941b1be2ce5b842237b487 --- .../intentresolver/ChooserPinMigrationReceiver.kt | 55 ---------------------- 1 file changed, 55 deletions(-) delete mode 100644 java/src/com/android/intentresolver/ChooserPinMigrationReceiver.kt (limited to 'java/src') diff --git a/java/src/com/android/intentresolver/ChooserPinMigrationReceiver.kt b/java/src/com/android/intentresolver/ChooserPinMigrationReceiver.kt deleted file mode 100644 index a3ba2192..00000000 --- a/java/src/com/android/intentresolver/ChooserPinMigrationReceiver.kt +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2023 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.intentresolver - -import android.content.BroadcastReceiver -import android.content.Context -import android.content.Intent -import android.content.SharedPreferences -import android.util.Log - -/** - * Broadcast receiver for receiving Chooser pin data from the legacy chooser. - * - * Unions the legacy pins with any existing pins. This receiver is protected by the ADD_CHOOSER_PINS - * permission. The receiver is required to have the RECEIVE_CHOOSER_PIN_MIGRATION to receive the - * broadcast. - */ -class ChooserPinMigrationReceiver( - private val pinnedSharedPrefsProvider: (Context) -> SharedPreferences = - { context -> ChooserActivity.getPinnedSharedPrefs(context) }, -) : BroadcastReceiver() { - - override fun onReceive(context: Context, intent: Intent) { - val bundle = intent.extras ?: return - Log.i(TAG, "Starting migration") - - val prefsEditor = pinnedSharedPrefsProvider.invoke(context).edit() - bundle.keySet().forEach { key -> - if(bundle.getBoolean(key)) { - prefsEditor.putBoolean(key, true) - } - } - prefsEditor.apply() - - Log.i(TAG, "Migration complete") - } - - companion object { - private const val TAG = "ChooserPinMigrationReceiver" - } -} \ No newline at end of file -- cgit v1.2.3-59-g8ed1b