Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 139685e5 authored by Abhisek Devkota's avatar Abhisek Devkota Committed by Rashed Abdel-Tawab
Browse files

Fix migration from pre-O for AndroidTV devices (1/2)

Change-Id: I934331ae8c91a6a11e7a620e28ddb6db92a03040
(cherry picked from commit 23163753)
parent bdccdc5a
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
/**
 * Copyright (c) 2016, The Linux Foundation. All rights reserved.
 *
 * Not a Contribution
 *
 * Copyright (c) 2017-2019, The LineageOS 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.
 */
-->
<resources>
    <string name="def_tv_user_setup_complete" translatable="false"></string>
</resources>
+13 −0
Original line number Diff line number Diff line
@@ -226,6 +226,7 @@ public class SettingsProvider extends ContentProvider {
    private static final Set<String> CRITICAL_SECURE_SETTINGS = new ArraySet<>();
    static {
        CRITICAL_SECURE_SETTINGS.add(Settings.Secure.USER_SETUP_COMPLETE);
        CRITICAL_SECURE_SETTINGS.add(Settings.Secure.TV_USER_SETUP_COMPLETE);
    }

    // Per user secure settings that moved to the for all users global settings.
@@ -3739,6 +3740,18 @@ public class SettingsProvider extends ContentProvider {

                if (currentVersion == 144) {
                    // Version 145: Removed
                    // Repurpose for AndroidTV devices coming from N
                    final SettingsState secureSettings = getSecureSettingsLocked(userId);
                    String defaultTvSetupSetting = (getContext().getResources().getString(
                            R.string.def_tv_user_setup_complete));
                    String currentUserSetupSetting = secureSettings.getSettingLocked(
                            Settings.Secure.USER_SETUP_COMPLETE).getValue();
                    if (defaultTvSetupSetting != null && !defaultTvSetupSetting.isEmpty() &&
                            currentUserSetupSetting == "1") {
                        secureSettings.insertSettingLocked(
                                Settings.Secure.TV_USER_SETUP_COMPLETE, "1",
                                null, true, SettingsState.SYSTEM_PACKAGE_NAME);
                    }
                    currentVersion = 145;
                }