Settings: Expose clipboard auto clear setting [2/2]

[someone5678]
* Adapt to current project
* Use Settings instead of DeviceConfig as GMS don't likes it
* Add switch for clipboard auto clear
* Import resources from CalyxOS and crDroid Android and adapt it
* Update summary setting logic

Ref:
72db57c966
48e00e2b81
33c49aa70c
bc81eea9cc

Issue: calyxos#2208
Change-Id: Ie101177aba90ea085d83c0cb641ffed447cceecd
Signed-off-by: someone5678 <59456192+someone5678@users.noreply.github.com>
This commit is contained in:
Oliver Scott
2024-08-27 10:26:16 -04:00
committed by Joey
parent da8ea87e85
commit 70acdc87e7
5 changed files with 163 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
/*
* Copyright (C) 2024 TheParasiteProject
*
* 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.custom.privacy;
import android.content.Context;
import android.os.Bundle;
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settingslib.search.SearchIndexable;
import java.util.List;
@SearchIndexable
public class ClipboardAutoClearFragment extends SettingsPreferenceFragment {
public static final String TAG = "ClipboardAutoClearFragment";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.clipboard_auto_clear_settings);
}
@Override
public int getMetricsCategory() {
return MetricsProto.MetricsEvent.EVOLVER;
}
/**
* For search
*/
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
new BaseSearchIndexProvider(R.xml.clipboard_auto_clear_settings) {
@Override
public List<String> getNonIndexableKeys(Context context) {
List<String> keys = super.getNonIndexableKeys(context);
return keys;
}
};
}