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

Commit 87ba74e3 authored by frankpreel's avatar frankpreel
Browse files

Hide FmD if no SIM slot available

parent aaf2d9d8
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -179,7 +179,8 @@
        android:summary="@string/find_my_device_dashboard_summary"
        android:icon="@drawable/ic_e_settings_find_my_device"
        android:order="-31"
        android:fragment="com.android.settings.findmydevice.FindMyDeviceDashboardFragment"/>
        android:fragment="com.android.settings.findmydevice.FindMyDeviceDashboardFragment"
        settings:controller="com.android.settings.findmydevice.TopLevelFindMyDeviceEntryPreferenceController"/>

    <com.android.settings.widget.HomepagePreference
        android:fragment="com.android.settings.location.LocationSettings"
+49 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019-2025 ECORP SAS
 *
 * 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.settings.findmydevice;

import android.content.Context;

import androidx.annotation.NonNull;

import com.android.settings.core.BasePreferenceController;

import android.content.pm.PackageManager;

/** The preference controller for the top level Find my device tile. */
public class TopLevelFindMyDeviceEntryPreferenceController extends BasePreferenceController {

    private Context _context;

    public TopLevelFindMyDeviceEntryPreferenceController(@NonNull Context context, @NonNull String key) {
        super(context, key);
        _context = context;
    }

    private boolean isTelephony() {
        PackageManager pm = _context.getPackageManager();
        return pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY);
    }

    @Override
    public int getAvailabilityStatus() {
        if (isTelephony()) {
            return AVAILABLE;
        }
        return CONDITIONALLY_UNAVAILABLE;
    }
}