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

Commit 2e265d4a authored by Jacky Wang's avatar Jacky Wang
Browse files

[Catalyst] Introduce SettingsContract file

The new file contains all contract constants for external usages (e.g.
slice, external Get/Set API). Also reuse existing constants in
SettingsSlicesContract.

NO_IFTTT=Catalyst only

Bug: 388061003
Flag: EXEMPT refactor
Test: atest
Change-Id: I449b7b6cf82e1e102f2c96a21835191605f09943
parent 1ecacd8a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
import android.provider.SettingsSlicesContract;
import android.util.Log;

import androidx.core.graphics.drawable.IconCompat;
@@ -37,6 +36,7 @@ import androidx.slice.builders.SliceAction;
import com.android.settings.R;
import com.android.settings.SubSettings;
import com.android.settings.connecteddevice.BluetoothDashboardFragment;
import com.android.settings.contract.SettingsContractKt;
import com.android.settings.network.SatelliteRepository;
import com.android.settings.slices.CustomSliceRegistry;
import com.android.settings.slices.SliceBroadcastReceiver;
@@ -118,7 +118,7 @@ public class BluetoothSliceBuilder {
    public static Intent getIntent(Context context) {
        final String screenTitle = context.getText(R.string.bluetooth_settings_title).toString();
        final Uri contentUri = new Uri.Builder().appendPath(
                SettingsSlicesContract.KEY_BLUETOOTH).build();
                SettingsContractKt.KEY_BLUETOOTH).build();
        return SliceBuilderUtils.buildSearchResultPageIntent(context,
                BluetoothDashboardFragment.class.getName(), null /* key */, screenTitle,
                SettingsEnums.SETTINGS_CONNECTED_DEVICE_CATEGORY,
+34 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 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.settings.contract

import android.provider.SettingsSlicesContract

/** Contract key for the "Airplane Mode" setting. */
const val KEY_AIRPLANE_MODE = SettingsSlicesContract.KEY_AIRPLANE_MODE

/** Contract key for the "Battery Saver" setting. */
const val KEY_BATTERY_SAVER = SettingsSlicesContract.KEY_BATTERY_SAVER

/** Contract key for the "Bluetooth" setting. */
const val KEY_BLUETOOTH = SettingsSlicesContract.KEY_BLUETOOTH

/** Contract key for the "Location" setting. */
const val KEY_LOCATION = SettingsSlicesContract.KEY_LOCATION

/** Contract key for the "Wi-fi" setting. */
const val KEY_WIFI = SettingsSlicesContract.KEY_WIFI
+2 −1
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.provider.SettingsSlicesContract;
import androidx.preference.PreferenceScreen;

import com.android.settings.R;
import com.android.settings.contract.SettingsContractKt;
import com.android.settings.core.TogglePreferenceController;
import com.android.settings.fuelgauge.BatterySaverReceiver;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
@@ -73,7 +74,7 @@ public class BatterySaverButtonPreferenceController extends TogglePreferenceCont
                .scheme(ContentResolver.SCHEME_CONTENT)
                .authority(SettingsSlicesContract.AUTHORITY)
                .appendPath(SettingsSlicesContract.PATH_SETTING_ACTION)
                .appendPath(SettingsSlicesContract.KEY_BATTERY_SAVER)
                .appendPath(SettingsContractKt.KEY_BATTERY_SAVER)
                .build();
    }

+2 −2
Original line number Diff line number Diff line
@@ -17,10 +17,10 @@

package com.android.settings.location;

import static android.provider.SettingsSlicesContract.KEY_LOCATION;

import static androidx.slice.builders.ListBuilder.ICON_IMAGE;

import static com.android.settings.contract.SettingsContractKt.KEY_LOCATION;

import android.annotation.ColorInt;
import android.app.PendingIntent;
import android.app.settings.SettingsEnums;
+2 −1
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import androidx.preference.TwoStatePreference;
import com.android.settings.AirplaneModeEnabler;
import com.android.settings.R;
import com.android.settings.Utils;
import com.android.settings.contract.SettingsContractKt;
import com.android.settings.core.TogglePreferenceController;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnDestroy;
@@ -64,7 +65,7 @@ public class AirplaneModePreferenceController extends TogglePreferenceController
            .scheme(ContentResolver.SCHEME_CONTENT)
            .authority(SettingsSlicesContract.AUTHORITY)
            .appendPath(SettingsSlicesContract.PATH_SETTING_ACTION)
            .appendPath(SettingsSlicesContract.KEY_AIRPLANE_MODE)
            .appendPath(SettingsContractKt.KEY_AIRPLANE_MODE)
            .build();

    private Fragment mFragment;
Loading