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

Commit f7e5d7a7 authored by Zemiao Zhu's avatar Zemiao Zhu Committed by Automerger Merge Worker
Browse files

Disable launcher icon for S. am: 5a0b5e73

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/DocumentsUI/+/14490414

Change-Id: If6ab3cbf332eac00d83f464bbd1b9f401a787629
parents 0d0f498a 5a0b5e73
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2021 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.
  -->

<resources>
    <!-- Starting from Android S, using DocumentsUI as a file browser with launcher icon is no
    longer supported. -->
    <bool name="is_launcher_enabled">false</bool>
</resources>
+8 −3
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import android.content.res.Resources;
import android.util.Log;

import com.android.documentsui.theme.ThemeOverlayManager;
import com.android.documentsui.util.VersionUtils;

/**
 * A receiver listening action.PRE_BOOT_COMPLETED event for setting component enable or disable.
@@ -91,11 +92,15 @@ public class PreBootReceiver extends BroadcastReceiver {
        int resId = overlayRes.getIdentifier(config, "bool", overlayPkg);
        if (resId != 0) {
            final ComponentName component = new ComponentName(packageName, className);
            final boolean value = overlayRes.getBoolean(resId);
            boolean enabled = overlayRes.getBoolean(resId);
            if (VersionUtils.isAtLeastS() && CONFIG_IS_LAUNCHER_ENABLED.equals(config)) {
                enabled = false; // Do not allow LauncherActivity to be enabled for S+.
            }
            if (DEBUG) {
                Log.i(TAG, "Overlay package:" + overlayPkg + ", customize " + config + ":" + value);
                Log.i(TAG,
                        "Overlay package:" + overlayPkg + ", customize " + config + ":" + enabled);
            }
            pm.setComponentEnabledSetting(component, value
            pm.setComponentEnabledSetting(component, enabled
                            ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
                            : PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
                    PackageManager.DONT_KILL_APP);