├── Android.bp ├── LICENSES └── Apache-2.0.txt ├── REUSE.toml ├── lib ├── Android.bp └── src │ └── java │ └── org │ └── lineageos │ └── lib │ └── phone │ └── SensitivePhoneNumbers.java ├── lineage ├── lib │ └── main │ │ └── java │ │ └── org │ │ └── lineageos │ │ └── platform │ │ └── internal │ │ ├── LineageBaseFeature.java │ │ ├── LineageGlobalActionsService.java │ │ ├── LineageHardwareService.java │ │ ├── LineageSettingsService.java │ │ ├── LineageSystemServer.java │ │ ├── LineageSystemService.java │ │ ├── ProfileManagerService.java │ │ ├── ProfileTriggerHelper.java │ │ ├── TrustInterfaceService.java │ │ ├── common │ │ ├── LineageSystemServiceHelper.java │ │ └── UserContentObserver.java │ │ ├── display │ │ ├── AmbientLuxObserver.java │ │ ├── ColorTemperatureController.java │ │ ├── DisplayHardwareController.java │ │ ├── LiveDisplayFeature.java │ │ ├── LiveDisplayService.java │ │ ├── OutdoorModeController.java │ │ ├── PictureAdjustmentController.java │ │ ├── TwilightCalculator.java │ │ └── TwilightTracker.java │ │ └── health │ │ ├── ChargingControlController.java │ │ ├── ChargingControlNotification.java │ │ ├── HealthInterfaceService.java │ │ ├── LineageHealthFeature.java │ │ ├── Util.java │ │ └── ccprovider │ │ ├── ChargingControlProvider.java │ │ ├── Deadline.java │ │ ├── Limit.java │ │ └── Toggle.java └── res │ ├── AndroidManifest.xml │ └── res │ ├── anim │ ├── last_app_in.xml │ └── last_app_out.xml │ ├── drawable │ ├── ic_charging_control.xml │ ├── ic_launcher_background.xml │ ├── ic_launcher_foreground.xml │ ├── ic_launcher_lineageos.xml │ ├── ic_livedisplay_auto.xml │ ├── ic_livedisplay_day.xml │ ├── ic_livedisplay_night.xml │ ├── ic_livedisplay_notif.xml │ ├── ic_livedisplay_off.xml │ ├── ic_livedisplay_outdoor.xml │ ├── ic_lock_profile.xml │ ├── ic_qs_themes.xml │ ├── ic_settings_profiles.xml │ ├── ic_trust.xml │ ├── ic_trust_notification_manage.xml │ ├── ic_warning.xml │ ├── stat_sys_network_traffic_down.xml │ ├── stat_sys_network_traffic_up.xml │ └── stat_sys_network_traffic_updown.xml │ ├── mipmap-anydpi │ └── ic_launcher.xml │ ├── values-af │ └── strings.xml │ ├── values-ar │ └── strings.xml │ ├── values-as │ └── strings.xml │ ├── values-ast-rES │ └── strings.xml │ ├── values-az │ └── strings.xml │ ├── values-be │ └── strings.xml │ ├── values-bg │ └── strings.xml │ ├── values-ca │ └── strings.xml │ ├── values-cs │ └── strings.xml │ ├── values-cy │ └── strings.xml │ ├── values-da │ └── strings.xml │ ├── values-de │ └── strings.xml │ ├── values-el │ └── strings.xml │ ├── values-en-rAU │ └── strings.xml │ ├── values-en-rCA │ └── strings.xml │ ├── values-en-rGB │ └── strings.xml │ ├── values-en-rIN │ └── strings.xml │ ├── values-eo │ └── strings.xml │ ├── values-es-rMX │ └── strings.xml │ ├── values-es-rUS │ └── strings.xml │ ├── values-es │ └── strings.xml │ ├── values-et │ └── strings.xml │ ├── values-eu │ └── strings.xml │ ├── values-fa │ └── strings.xml │ ├── values-fi │ └── strings.xml │ ├── values-fr │ └── strings.xml │ ├── values-fur-rIT │ └── strings.xml │ ├── values-fy-rNL │ └── strings.xml │ ├── values-ga-rIE │ └── strings.xml │ ├── values-gd │ └── strings.xml │ ├── values-gl │ └── strings.xml │ ├── values-gu │ └── strings.xml │ ├── values-hr │ └── strings.xml │ ├── values-hu │ └── strings.xml │ ├── values-in │ └── strings.xml │ ├── values-is │ └── strings.xml │ ├── values-it │ └── strings.xml │ ├── values-iw │ └── strings.xml │ ├── values-ja │ └── strings.xml │ ├── values-ka │ └── strings.xml │ ├── values-kab-rDZ │ └── strings.xml │ ├── values-kn │ └── strings.xml │ ├── values-ko │ └── strings.xml │ ├── values-lb │ └── strings.xml │ ├── values-lt │ └── strings.xml │ ├── values-ml │ └── strings.xml │ ├── values-mr │ └── strings.xml │ ├── values-nb │ └── strings.xml │ ├── values-nl │ └── strings.xml │ ├── values-or │ └── strings.xml │ ├── values-pl │ └── strings.xml │ ├── values-pt-rBR │ └── strings.xml │ ├── values-pt-rPT │ └── strings.xml │ ├── values-ro │ └── strings.xml │ ├── values-ru │ └── strings.xml │ ├── values-sc-rIT │ └── strings.xml │ ├── values-sk │ └── strings.xml │ ├── values-sl │ └── strings.xml │ ├── values-sq │ └── strings.xml │ ├── values-sr │ └── strings.xml │ ├── values-sv │ └── strings.xml │ ├── values-sw600dp │ └── config.xml │ ├── values-ta │ └── strings.xml │ ├── values-te │ └── strings.xml │ ├── values-th │ └── strings.xml │ ├── values-tr │ └── strings.xml │ ├── values-ug │ └── strings.xml │ ├── values-uk │ └── strings.xml │ ├── values-vi │ └── strings.xml │ ├── values-zh-rCN │ └── strings.xml │ ├── values-zh-rHK │ └── strings.xml │ ├── values-zh-rTW │ └── strings.xml │ ├── values │ ├── arrays.xml │ ├── colors.xml │ ├── config.xml │ ├── dimens.xml │ ├── strings.xml │ └── symbols.xml │ └── xml │ └── profile_default.xml ├── packages ├── LineagePreferenceLib │ ├── Android.bp │ ├── AndroidManifest.xml │ ├── java │ │ └── lineageos │ │ │ └── preference │ │ │ ├── ConstraintsHelper.java │ │ │ ├── GlobalSettingMainSwitchPreference.java │ │ │ ├── GlobalSettingSwitchPreference.java │ │ │ ├── LineageGlobalSettingListPreference.java │ │ │ ├── LineageGlobalSettingMainSwitchPreference.java │ │ │ ├── LineageGlobalSettingSwitchPreference.java │ │ │ ├── LineagePartsPreference.java │ │ │ ├── LineageSecureSettingListPreference.java │ │ │ ├── LineageSecureSettingMainSwitchPreference.java │ │ │ ├── LineageSecureSettingSwitchPreference.java │ │ │ ├── LineageSystemSettingDropDownPreference.java │ │ │ ├── LineageSystemSettingListPreference.java │ │ │ ├── LineageSystemSettingMainSwitchPreference.java │ │ │ ├── LineageSystemSettingSwitchPreference.java │ │ │ ├── PartInfo.aidl │ │ │ ├── PartInfo.java │ │ │ ├── PartsList.java │ │ │ ├── RemotePreference.java │ │ │ ├── RemotePreferenceManager.java │ │ │ ├── RemotePreferenceUpdater.java │ │ │ ├── SecureSettingMainSwitchPreference.java │ │ │ ├── SecureSettingSwitchPreference.java │ │ │ ├── SelfRemovingDropDownPreference.java │ │ │ ├── SelfRemovingListPreference.java │ │ │ ├── SelfRemovingPreference.java │ │ │ ├── SelfRemovingSwitchPreference.java │ │ │ ├── SettingsHelper.java │ │ │ ├── SystemSettingMainSwitchPreference.java │ │ │ └── SystemSettingSwitchPreference.java │ └── res │ │ └── values │ │ ├── attrs.xml │ │ ├── public.xml │ │ └── symbols.xml └── LineageSettingsProvider │ ├── Android.bp │ ├── AndroidManifest.xml │ ├── privapp_whitelist_org.lineageos.lineagesettings.xml │ ├── res │ ├── drawable │ │ ├── ic_launcher_background.xml │ │ └── ic_launcher_foreground.xml │ ├── mipmap-anydpi │ │ └── ic_launcher.xml │ ├── values-ar │ │ └── strings.xml │ ├── values-ast-rES │ │ └── strings.xml │ ├── values-az │ │ └── strings.xml │ ├── values-be │ │ └── strings.xml │ ├── values-bg │ │ └── strings.xml │ ├── values-ca │ │ └── strings.xml │ ├── values-cs │ │ └── strings.xml │ ├── values-cy │ │ └── strings.xml │ ├── values-da │ │ └── strings.xml │ ├── values-de │ │ └── strings.xml │ ├── values-el │ │ └── strings.xml │ ├── values-en-rAU │ │ └── strings.xml │ ├── values-en-rCA │ │ └── strings.xml │ ├── values-en-rGB │ │ └── strings.xml │ ├── values-en-rIN │ │ └── strings.xml │ ├── values-es-rUS │ │ └── strings.xml │ ├── values-es │ │ └── strings.xml │ ├── values-et │ │ └── strings.xml │ ├── values-eu │ │ └── strings.xml │ ├── values-fa │ │ └── strings.xml │ ├── values-fi │ │ └── strings.xml │ ├── values-fr │ │ └── strings.xml │ ├── values-fur-rIT │ │ └── strings.xml │ ├── values-fy-rNL │ │ └── strings.xml │ ├── values-ga-rIE │ │ └── strings.xml │ ├── values-gd │ │ └── strings.xml │ ├── values-gl │ │ └── strings.xml │ ├── values-hr │ │ └── strings.xml │ ├── values-hu │ │ └── strings.xml │ ├── values-in │ │ └── strings.xml │ ├── values-is │ │ └── strings.xml │ ├── values-it │ │ └── strings.xml │ ├── values-iw │ │ └── strings.xml │ ├── values-ja │ │ └── strings.xml │ ├── values-ka │ │ └── strings.xml │ ├── values-kab-rDZ │ │ └── strings.xml │ ├── values-kn │ │ └── strings.xml │ ├── values-ko │ │ └── strings.xml │ ├── values-nb │ │ └── strings.xml │ ├── values-nl │ │ └── strings.xml │ ├── values-pl │ │ └── strings.xml │ ├── values-pt-rBR │ │ └── strings.xml │ ├── values-pt-rPT │ │ └── strings.xml │ ├── values-ro │ │ └── strings.xml │ ├── values-ru │ │ └── strings.xml │ ├── values-sc-rIT │ │ └── strings.xml │ ├── values-sk │ │ └── strings.xml │ ├── values-sl │ │ └── strings.xml │ ├── values-sq │ │ └── strings.xml │ ├── values-sr │ │ └── strings.xml │ ├── values-sv │ │ └── strings.xml │ ├── values-ta │ │ └── strings.xml │ ├── values-th │ │ └── strings.xml │ ├── values-tr │ │ └── strings.xml │ ├── values-uk │ │ └── strings.xml │ ├── values-vi │ │ └── strings.xml │ ├── values-zh-rCN │ │ └── strings.xml │ ├── values-zh-rTW │ │ └── strings.xml │ └── values │ │ ├── defaults.xml │ │ └── strings.xml │ └── src │ └── org │ └── lineageos │ └── lineagesettings │ ├── LineageDatabaseHelper.java │ └── LineageSettingsProvider.java └── sdk └── src └── java ├── lineageos ├── app │ ├── ILineageGlobalActions.aidl │ ├── IProfileManager.aidl │ ├── LineageContextConstants.java │ ├── LineageGlobalActions.java │ ├── NotificationGroup.aidl │ ├── NotificationGroup.java │ ├── Profile.aidl │ ├── Profile.java │ ├── ProfileGroup.java │ └── ProfileManager.java ├── content │ └── Intent.java ├── hardware │ ├── DisplayMode.aidl │ ├── DisplayMode.java │ ├── HIDLHelper.java │ ├── HSIC.aidl │ ├── HSIC.java │ ├── ILineageHardwareService.aidl │ ├── ILiveDisplayService.aidl │ ├── LineageHardwareManager.java │ ├── LiveDisplayConfig.aidl │ ├── LiveDisplayConfig.java │ ├── LiveDisplayManager.java │ ├── TouchscreenGesture.aidl │ └── TouchscreenGesture.java ├── health │ ├── HealthInterface.java │ └── IHealthInterface.aidl ├── profiles │ ├── AirplaneModeSettings.java │ ├── BrightnessSettings.java │ ├── ConnectionSettings.java │ ├── LockSettings.java │ ├── RingModeSettings.java │ └── StreamSettings.java ├── providers │ └── LineageSettings.java ├── trust │ ├── ITrustInterface.aidl │ └── TrustInterface.java └── util │ ├── ColorUtils.java │ └── palette │ ├── ColorCutQuantizer.java │ ├── ColorUtils.java │ ├── DefaultGenerator.java │ └── Palette.java └── org └── lineageos └── internal ├── applications ├── LineageActivityManager.java └── LongScreen.java ├── buttons └── LineageButtons.java ├── graphics └── drawable │ └── StopMotionVectorDrawable.java ├── logging └── LineageMetricsLogger.java ├── notification ├── LedValues.java ├── LightsCapabilities.java ├── LineageBatteryLights.java ├── LineageNotification.java └── LineageNotificationLights.java ├── statusbar ├── LineageStatusBarItem.java └── NetworkTraffic.java └── util ├── ActionUtils.java ├── DeviceKeysConstants.java ├── FileUtils.java ├── ImageUtils.java ├── LineageLockPatternUtils.java ├── MathUtils.java ├── PackageManagerUtils.java ├── PowerMenuConstants.java ├── PowerMenuUtils.java └── ScreenType.java /Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // SPDX-FileCopyrightText: 2018-2024 The LineageOS Project 3 | // SPDX-License-Identifier: Apache-2.0 4 | // 5 | 6 | android_app { 7 | name: "org.lineageos.platform-res", 8 | use_resource_processor: false, 9 | sdk_version: "core_platform", 10 | certificate: "platform", 11 | 12 | manifest: "lineage/res/AndroidManifest.xml", 13 | 14 | // Disable dexpreopt and verify_uses_libraries check as the app 15 | // contains no Java code to be dexpreopted. 16 | enforce_uses_libs: false, 17 | dex_preopt: { 18 | enabled: false, 19 | }, 20 | 21 | // Soong special-cases org.lineageos.platform-res to install this alongside 22 | // the libraries at /system_ext/framework/org.lineageos.platform-res.apk. 23 | 24 | aaptflags: [ 25 | "--private-symbols", 26 | "org.lineageos.platform.internal", 27 | 28 | // Framework doesn't need versioning since it IS the platform. 29 | "--no-auto-version", 30 | 31 | // Allow overlay to add resource 32 | "--auto-add-overlay", 33 | 34 | // Tell aapt to create "extending (non-application)" resource IDs, 35 | // since these resources will be used by many apps. 36 | "--allow-reserved-package-id", 37 | // Use id 0x3f (one less than app id). 38 | "--package-id", 39 | "63", 40 | ], 41 | 42 | resource_dirs: [ 43 | "lineage/res/res", 44 | ], 45 | 46 | // Create package-export.apk, which other packages can use to get 47 | // PRODUCT-agnostic resource data like IDs and type definitions. 48 | export_package_resources: true, 49 | } 50 | 51 | // The LineageOS Platform Framework Library 52 | // ============================================================ 53 | 54 | lineage_sdk_src = "sdk/src/java/lineageos" 55 | lineage_sdk_internal_src = "sdk/src/java/org/lineageos/internal" 56 | library_src = "lineage/lib/main/java" 57 | 58 | lineage_sdk_LOCAL_STATIC_JAVA_LIBRARIES = [ 59 | "vendor.lineage.health-V2-java", 60 | "vendor.lineage.livedisplay-V2.0-java", 61 | "vendor.lineage.livedisplay-V2.1-java", 62 | "vendor.lineage.touch-V1.0-java", 63 | ] 64 | 65 | java_library { 66 | name: "org.lineageos.platform", 67 | installable: true, 68 | sdk_version: "core_platform", 69 | static_libs: lineage_sdk_LOCAL_STATIC_JAVA_LIBRARIES, 70 | 71 | libs: [ 72 | "framework", 73 | "services", 74 | ], 75 | 76 | srcs: [ 77 | lineage_sdk_src + "/**/*.java", 78 | lineage_sdk_internal_src + "/**/*.java", 79 | library_src + "/**/*.java", 80 | lineage_sdk_src + "/**/I*.aidl", 81 | lineage_sdk_internal_src + "/**/I*.aidl", 82 | 83 | // For the generated R.java and Manifest.java 84 | ":org.lineageos.platform-res{.aapt.srcjar}", 85 | ], 86 | 87 | // Include aidl files from lineageos.app namespace as well as internal src aidl files 88 | aidl: { 89 | local_include_dirs: ["sdk/src/java"], 90 | }, 91 | } 92 | 93 | // Full target for use by platform apps 94 | // ============================================================ 95 | 96 | java_library { 97 | name: "org.lineageos.platform.internal", 98 | static_libs: lineage_sdk_LOCAL_STATIC_JAVA_LIBRARIES, 99 | 100 | srcs: [ 101 | lineage_sdk_src + "/**/*.java", 102 | lineage_sdk_internal_src + "/**/*.java", 103 | lineage_sdk_src + "/**/I*.aidl", 104 | lineage_sdk_internal_src + "/**/I*.aidl", 105 | 106 | // For the generated R.java and Manifest.java 107 | ":org.lineageos.platform-res{.aapt.srcjar}", 108 | ], 109 | 110 | aidl: { 111 | local_include_dirs: ["sdk/src/java"], 112 | }, 113 | } 114 | -------------------------------------------------------------------------------- /REUSE.toml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2024 The LineageOS Project 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | version = 1 5 | SPDX-PackageName = "SDK" 6 | SPDX-PackageSupplier = "The LineageOS Project" 7 | SPDX-PackageDownloadLocation = "https://github.com/LineageOS/android_lineage-sdk" 8 | 9 | [[annotations]] 10 | path = [".gitignore"] 11 | precedence = "aggregate" 12 | SPDX-FileCopyrightText = "2023 The LineageOS Project" 13 | SPDX-License-Identifier = "Apache-2.0" 14 | -------------------------------------------------------------------------------- /lib/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // SPDX-FileCopyrightText: 2019 The LineageOS Project 3 | // SPDX-License-Identifier: Apache-2.0 4 | // 5 | 6 | lineage_sdk_lib_src = "src/java/org/lineageos/lib/" 7 | 8 | java_library { 9 | name: "org.lineageos.lib.phone", 10 | sdk_version: "current", 11 | static_libs: [ 12 | "libphonenumber", 13 | ], 14 | 15 | srcs: [ 16 | lineage_sdk_lib_src + "/phone/*.java", 17 | ":spn-info", 18 | ], 19 | } 20 | -------------------------------------------------------------------------------- /lineage/lib/main/java/org/lineageos/platform/internal/LineageSettingsService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2018 The LineageOS Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.lineageos.platform.internal; 7 | 8 | import android.content.Context; 9 | 10 | import lineageos.app.LineageContextConstants; 11 | 12 | /** @hide */ 13 | public class LineageSettingsService extends LineageSystemService { 14 | 15 | private static final String TAG = LineageSettingsService.class.getSimpleName(); 16 | 17 | private final Context mContext; 18 | 19 | public LineageSettingsService(Context context) { 20 | super(context); 21 | mContext = context; 22 | } 23 | 24 | @Override 25 | public String getFeatureDeclaration() { 26 | return LineageContextConstants.Features.SETTINGS; 27 | } 28 | 29 | @Override 30 | public void onBootPhase(int phase) { 31 | } 32 | 33 | @Override 34 | public void onStart() { 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /lineage/lib/main/java/org/lineageos/platform/internal/LineageSystemService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2016 The CyanogenMod Project 3 | * SPDX-FileCopyrightText: 2024 The LineageOS Project 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package org.lineageos.platform.internal; 8 | 9 | import android.content.Context; 10 | 11 | import com.android.server.SystemService; 12 | 13 | public abstract class LineageSystemService extends SystemService { 14 | public LineageSystemService(Context context) { 15 | super(context); 16 | } 17 | 18 | public abstract String getFeatureDeclaration(); 19 | 20 | 21 | /** 22 | * Override and return true if the service should be started 23 | * before the device is decrypted. 24 | */ 25 | public boolean isCoreService() { 26 | return true; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lineage/lib/main/java/org/lineageos/platform/internal/common/LineageSystemServiceHelper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2016 The CyanogenMod Project 3 | * SPDX-FileCopyrightText: 2024 The LineageOS Project 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package org.lineageos.platform.internal.common; 8 | 9 | import android.content.Context; 10 | 11 | import org.lineageos.platform.internal.LineageSystemService; 12 | 13 | import java.lang.reflect.Constructor; 14 | import java.lang.reflect.InvocationTargetException; 15 | 16 | /** 17 | * Helper methods for fetching a LineageSystemService from a class declaration 18 | */ 19 | public class LineageSystemServiceHelper { 20 | private final Context mContext; 21 | 22 | public LineageSystemServiceHelper(Context context) { 23 | mContext = context; 24 | } 25 | 26 | public LineageSystemService getServiceFor(String className) { 27 | final Class serviceClass; 28 | try { 29 | serviceClass = (Class)Class.forName(className); 30 | } catch (ClassNotFoundException ex) { 31 | throw new RuntimeException("Failed to create service " + className 32 | + ": service class not found", ex); 33 | } 34 | 35 | return getServiceFromClass(serviceClass); 36 | } 37 | 38 | public T getServiceFromClass(Class serviceClass) { 39 | final T service; 40 | try { 41 | Constructor constructor = serviceClass.getConstructor(Context.class); 42 | service = constructor.newInstance(mContext); 43 | } catch (InstantiationException ex) { 44 | throw new RuntimeException("Failed to create service " + serviceClass 45 | + ": service could not be instantiated", ex); 46 | } catch (IllegalAccessException | NoSuchMethodException ex) { 47 | throw new RuntimeException("Failed to create service " + serviceClass 48 | + ": service must have a public constructor with a Context argument", ex); 49 | } catch (InvocationTargetException ex) { 50 | throw new RuntimeException("Failed to create service " + serviceClass 51 | + ": service constructor threw an exception", ex); 52 | } 53 | return service; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /lineage/lib/main/java/org/lineageos/platform/internal/common/UserContentObserver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2016 The CyanogenMod Project 3 | * SPDX-FileCopyrightText: 2024 The LineageOS Project 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | package org.lineageos.platform.internal.common; 7 | 8 | import android.app.ActivityManagerNative; 9 | import android.app.IUserSwitchObserver; 10 | import android.database.ContentObserver; 11 | import android.net.Uri; 12 | import android.os.Handler; 13 | import android.os.IRemoteCallback; 14 | import android.os.RemoteException; 15 | import android.util.Log; 16 | 17 | /** 18 | * Simple extension of ContentObserver that also listens for user switch events to call update 19 | */ 20 | public abstract class UserContentObserver extends ContentObserver { 21 | private static final String TAG = "UserContentObserver"; 22 | 23 | private final Runnable mUpdateRunnable; 24 | 25 | private final IUserSwitchObserver mUserSwitchObserver = new IUserSwitchObserver.Stub() { 26 | @Override 27 | public void onBeforeUserSwitching(int newUserId) throws RemoteException { 28 | } 29 | @Override 30 | public void onUserSwitching(int newUserId, IRemoteCallback reply) { 31 | } 32 | @Override 33 | public void onUserSwitchComplete(int newUserId) throws RemoteException { 34 | mHandler.post(mUpdateRunnable); 35 | } 36 | @Override 37 | public void onForegroundProfileSwitch(int newProfileId) { 38 | } 39 | @Override 40 | public void onLockedBootComplete(int newUserId) { 41 | } 42 | }; 43 | 44 | private final Handler mHandler; 45 | 46 | /** 47 | * Content observer that tracks user switches 48 | * to allow clients to re-load settings for current user 49 | */ 50 | public UserContentObserver(Handler handler) { 51 | super(handler); 52 | mHandler = handler; 53 | mUpdateRunnable = this::update; 54 | } 55 | 56 | protected void observe() { 57 | try { 58 | ActivityManagerNative.getDefault().registerUserSwitchObserver(mUserSwitchObserver, TAG); 59 | } catch (RemoteException e) { 60 | Log.w(TAG, "Unable to register user switch observer!", e); 61 | } 62 | } 63 | 64 | protected void unobserve() { 65 | try { 66 | mHandler.removeCallbacks(mUpdateRunnable); 67 | ActivityManagerNative.getDefault().unregisterUserSwitchObserver(mUserSwitchObserver); 68 | } catch (RemoteException e) { 69 | Log.w(TAG, "Unable to unregister user switch observer!", e); 70 | } 71 | } 72 | 73 | /** 74 | * Called to notify of registered uri changes and user switches. 75 | * Always invoked on the handler passed in at construction 76 | */ 77 | protected abstract void update(); 78 | 79 | @Override 80 | public void onChange(boolean selfChange, Uri uri) { 81 | update(); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /lineage/lib/main/java/org/lineageos/platform/internal/display/LiveDisplayFeature.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2016 The CyanogenMod Project 3 | * SPDX-FileCopyrightText: 2017-2024 The LineageOS Project 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | package org.lineageos.platform.internal.display; 7 | 8 | import static org.lineageos.platform.internal.display.LiveDisplayService.ALL_CHANGED; 9 | import static org.lineageos.platform.internal.display.LiveDisplayService.DISPLAY_CHANGED; 10 | import static org.lineageos.platform.internal.display.LiveDisplayService.MODE_CHANGED; 11 | import static org.lineageos.platform.internal.display.LiveDisplayService.TWILIGHT_CHANGED; 12 | 13 | import android.content.Context; 14 | import android.hardware.display.ColorDisplayManager; 15 | import android.os.Handler; 16 | import android.util.Log; 17 | 18 | import org.lineageos.platform.internal.LineageBaseFeature; 19 | import org.lineageos.platform.internal.display.LiveDisplayService.State; 20 | import org.lineageos.platform.internal.display.TwilightTracker.TwilightState; 21 | 22 | import java.util.BitSet; 23 | 24 | public abstract class LiveDisplayFeature extends LineageBaseFeature { 25 | 26 | protected static final String TAG = "LiveDisplay"; 27 | protected static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); 28 | 29 | protected final boolean mNightDisplayAvailable; 30 | 31 | private State mState; 32 | 33 | public LiveDisplayFeature(Context context, Handler handler) { 34 | super(context, handler); 35 | mNightDisplayAvailable = ColorDisplayManager.isNightDisplayAvailable(mContext); 36 | } 37 | 38 | public abstract boolean getCapabilities(final BitSet caps); 39 | 40 | protected abstract void onUpdate(); 41 | 42 | void update(final int flags, final State state) { 43 | mState = state; 44 | if ((flags & DISPLAY_CHANGED) != 0) { 45 | onScreenStateChanged(); 46 | } 47 | if (((flags & TWILIGHT_CHANGED) != 0) && mState.mTwilight != null) { 48 | onTwilightUpdated(); 49 | } 50 | if ((flags & MODE_CHANGED) != 0) { 51 | onUpdate(); 52 | } 53 | if (flags == ALL_CHANGED) { 54 | onSettingsChanged(null); 55 | } 56 | } 57 | 58 | protected void onScreenStateChanged() { } 59 | 60 | protected void onTwilightUpdated() { } 61 | 62 | protected final boolean isLowPowerMode() { 63 | return mState.mLowPowerMode; 64 | } 65 | 66 | protected final int getMode() { 67 | return mState.mMode; 68 | } 69 | 70 | protected final boolean isScreenOn() { 71 | return mState.mScreenOn; 72 | } 73 | 74 | protected final TwilightState getTwilight() { 75 | return mState.mTwilight; 76 | } 77 | 78 | public final boolean isNight() { 79 | return mState.mTwilight != null && mState.mTwilight.isNight(); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /lineage/lib/main/java/org/lineageos/platform/internal/health/LineageHealthFeature.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2023 The LineageOS Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.lineageos.platform.internal.health; 7 | 8 | import android.content.Context; 9 | import android.os.Handler; 10 | 11 | import org.lineageos.platform.internal.LineageBaseFeature; 12 | 13 | public abstract class LineageHealthFeature extends LineageBaseFeature { 14 | protected static final String TAG = "LineageHealth"; 15 | 16 | public LineageHealthFeature(Context context, Handler handler) { 17 | super(context, handler); 18 | } 19 | 20 | public abstract boolean isSupported(); 21 | } 22 | -------------------------------------------------------------------------------- /lineage/lib/main/java/org/lineageos/platform/internal/health/Util.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2024-2025 The LineageOS Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.lineageos.platform.internal.health; 7 | 8 | import android.content.Context; 9 | import android.text.format.DateFormat; 10 | 11 | import java.text.SimpleDateFormat; 12 | import java.time.LocalDate; 13 | import java.time.LocalTime; 14 | import java.time.ZoneId; 15 | import java.time.ZoneOffset; 16 | import java.time.ZonedDateTime; 17 | import java.util.Calendar; 18 | import java.util.TimeZone; 19 | 20 | public class Util { 21 | /** 22 | * Convert milliseconds to a string in the current locale's format. 23 | * 24 | * @param ms milliseconds from epoch 25 | * @return formatted time string in current time zone 26 | */ 27 | static public String msToString(Context context, long ms) { 28 | return DateFormat.getTimeFormat(context).format(msToLocalTime(ms).getTime()); 29 | } 30 | 31 | static private Calendar msToLocalTime(long ms) { 32 | Calendar calendar = Calendar.getInstance(); 33 | calendar.setTimeInMillis(ms); 34 | return calendar; 35 | } 36 | 37 | /** 38 | * Convert milliseconds to a string in the format "HH:mm:ss". 39 | * 40 | * @param ms time in milliseconds, should be less than 41 | * ${@link android.text.format.DateUtils#DAY_IN_MILLIS} 42 | * @return formatted time string in the format "HH:mm:ss" 43 | */ 44 | static public String msToHMSString(long ms) { 45 | final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss"); 46 | Calendar calendar = Calendar.getInstance(); 47 | dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); 48 | calendar.setTimeInMillis(ms); 49 | return dateFormat.format(calendar.getTime()); 50 | } 51 | 52 | /** 53 | * Convert the seconds of the day to UTC milliseconds from epoch. 54 | * 55 | * @param time seconds of the day 56 | * @return UTC milliseconds from epoch 57 | */ 58 | static public long getTimeMillisFromSecondOfDay(int time) { 59 | ZoneId utcZone = ZoneOffset.UTC; 60 | LocalDate currentDate = LocalDate.now(); 61 | LocalTime timeOfDay = LocalTime.ofSecondOfDay(time); 62 | 63 | ZonedDateTime zonedDateTime = ZonedDateTime.of(currentDate, timeOfDay, 64 | ZoneId.systemDefault()) 65 | .withZoneSameInstant(utcZone); 66 | return zonedDateTime.toInstant().toEpochMilli(); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /lineage/lib/main/java/org/lineageos/platform/internal/health/ccprovider/Deadline.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2024-2025 The LineageOS Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.lineageos.platform.internal.health.ccprovider; 7 | 8 | import static lineageos.health.HealthInterface.MODE_AUTO; 9 | import static lineageos.health.HealthInterface.MODE_MANUAL; 10 | 11 | import android.content.Context; 12 | import android.util.Log; 13 | 14 | import vendor.lineage.health.ChargingControlSupportedMode; 15 | import vendor.lineage.health.IChargingControl; 16 | 17 | import java.io.PrintWriter; 18 | 19 | public class Deadline extends ChargingControlProvider { 20 | private long mSavedTargetTime; 21 | 22 | public Deadline(IChargingControl chargingControl, Context context) { 23 | super(context, chargingControl); 24 | } 25 | 26 | @Override 27 | protected boolean onBatteryChanged(float batteryPct, long startTime, long targetTime, 28 | int configMode) { 29 | if (targetTime == mSavedTargetTime) { 30 | return true; 31 | } 32 | 33 | final long currentTime = System.currentTimeMillis(); 34 | final long deadline = (targetTime - currentTime) / 1000; 35 | 36 | Log.i(TAG, "Setting charge deadline: Deadline (seconds): " + deadline); 37 | 38 | try { 39 | mChargingControl.setChargingDeadline(deadline); 40 | mSavedTargetTime = targetTime; 41 | } catch (Exception e) { 42 | Log.e(TAG, "Failed to set charging deadline", e); 43 | return false; 44 | } 45 | 46 | return true; 47 | } 48 | 49 | @Override 50 | protected void onEnabled() { 51 | onReset(); 52 | } 53 | 54 | @Override 55 | protected void onDisable() { 56 | onReset(); 57 | } 58 | 59 | @Override 60 | protected void onReset() { 61 | mSavedTargetTime = 0; 62 | 63 | try { 64 | mChargingControl.setChargingDeadline(-1); 65 | } catch (Exception e) { 66 | Log.e(TAG, "Failed to reset charging deadline", e); 67 | } 68 | } 69 | 70 | @Override 71 | public void dump(PrintWriter pw) { 72 | pw.println("Provider: " + getClass().getName()); 73 | pw.println(" mSavedTargetTime: " + mSavedTargetTime); 74 | } 75 | 76 | @Override 77 | public boolean isSupported() { 78 | return isHALModeSupported(ChargingControlSupportedMode.DEADLINE); 79 | } 80 | 81 | @Override 82 | public boolean isChargingControlModeSupported(int mode) { 83 | return mode == MODE_AUTO || mode == MODE_MANUAL; 84 | } 85 | 86 | @Override 87 | public boolean requiresBatteryLevelMonitoring() { 88 | return false; 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /lineage/lib/main/java/org/lineageos/platform/internal/health/ccprovider/Limit.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2024-2025 The LineageOS Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.lineageos.platform.internal.health.ccprovider; 7 | 8 | import static lineageos.health.HealthInterface.MODE_AUTO; 9 | import static lineageos.health.HealthInterface.MODE_LIMIT; 10 | import static lineageos.health.HealthInterface.MODE_MANUAL; 11 | 12 | import android.content.Context; 13 | import android.util.Log; 14 | 15 | import org.lineageos.platform.internal.R; 16 | 17 | import vendor.lineage.health.ChargingControlSupportedMode; 18 | import vendor.lineage.health.ChargingLimitInfo; 19 | import vendor.lineage.health.IChargingControl; 20 | 21 | import java.io.PrintWriter; 22 | 23 | public class Limit extends ChargingControlProvider { 24 | protected final int mChargingLimitMargin; 25 | 26 | public Limit(IChargingControl chargingControl, Context context) { 27 | super(context, chargingControl); 28 | 29 | boolean isBypassSupported = isHALModeSupported(ChargingControlSupportedMode.BYPASS); 30 | if (!isBypassSupported) { 31 | mChargingLimitMargin = mContext.getResources().getInteger( 32 | R.integer.config_chargingControlBatteryRechargeMargin); 33 | } else { 34 | mChargingLimitMargin = 1; 35 | } 36 | Log.i(TAG, "isBypassSupported: " + isBypassSupported); 37 | } 38 | 39 | @Override 40 | protected boolean onBatteryChanged(float currentPct, int targetPct) { 41 | Log.i(TAG, "Current battery level: " + currentPct + ", target: " + targetPct); 42 | return setChargingLimit(targetPct); 43 | } 44 | 45 | @Override 46 | protected void onEnabled() { 47 | onReset(); 48 | } 49 | 50 | @Override 51 | protected void onDisable() { 52 | onReset(); 53 | } 54 | 55 | @Override 56 | protected void onReset() { 57 | setChargingLimit(100); 58 | } 59 | 60 | private boolean setChargingLimit(int targetPct) { 61 | try { 62 | if (mChargingControl.getChargingLimit().max != targetPct) { 63 | ChargingLimitInfo limit = new ChargingLimitInfo(); 64 | if (targetPct == 100) { 65 | limit.min = 0; 66 | } else { 67 | limit.min = targetPct - mChargingLimitMargin; 68 | } 69 | limit.max = targetPct; 70 | mChargingControl.setChargingLimit(limit); 71 | } 72 | return true; 73 | } catch (Exception e) { 74 | Log.e(TAG, "Failed to set charging limit", e); 75 | return false; 76 | } 77 | } 78 | 79 | @Override 80 | public boolean isSupported() { 81 | return isHALModeSupported(ChargingControlSupportedMode.LIMIT); 82 | } 83 | 84 | @Override 85 | public boolean requiresBatteryLevelMonitoring() { 86 | return !isHALModeSupported(ChargingControlSupportedMode.BYPASS); 87 | } 88 | 89 | @Override 90 | public boolean isChargingControlModeSupported(int mode) { 91 | return mode == MODE_AUTO || mode == MODE_MANUAL || mode == MODE_LIMIT; 92 | } 93 | 94 | @Override 95 | public void dump(PrintWriter pw) { 96 | pw.println("Provider: " + getClass().getName()); 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /lineage/res/res/anim/last_app_in.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 12 | 17 | 22 | 25 | 26 | -------------------------------------------------------------------------------- /lineage/res/res/anim/last_app_out.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 12 | 17 | 22 | 25 | 26 | -------------------------------------------------------------------------------- /lineage/res/res/drawable/ic_charging_control.xml: -------------------------------------------------------------------------------- 1 | 5 | 10 | 13 | 16 | 17 | -------------------------------------------------------------------------------- /lineage/res/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 11 | 14 | 15 | -------------------------------------------------------------------------------- /lineage/res/res/drawable/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 12 | 13 | 15 | 18 | 21 | 22 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /lineage/res/res/drawable/ic_launcher_lineageos.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 11 | 12 | 15 | 16 | -------------------------------------------------------------------------------- /lineage/res/res/drawable/ic_livedisplay_auto.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 11 | 12 | 18 | -------------------------------------------------------------------------------- /lineage/res/res/drawable/ic_livedisplay_day.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 11 | 12 | 19 | -------------------------------------------------------------------------------- /lineage/res/res/drawable/ic_livedisplay_night.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 11 | 12 | 18 | -------------------------------------------------------------------------------- /lineage/res/res/drawable/ic_livedisplay_notif.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 11 | 12 | 18 | -------------------------------------------------------------------------------- /lineage/res/res/drawable/ic_livedisplay_off.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 11 | 12 | 19 | -------------------------------------------------------------------------------- /lineage/res/res/drawable/ic_livedisplay_outdoor.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 11 | 12 | 16 | -------------------------------------------------------------------------------- /lineage/res/res/drawable/ic_lock_profile.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 9 | -------------------------------------------------------------------------------- /lineage/res/res/drawable/ic_qs_themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 11 | 12 | 17 | -------------------------------------------------------------------------------- /lineage/res/res/drawable/ic_settings_profiles.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 11 | 12 | 15 | 16 | -------------------------------------------------------------------------------- /lineage/res/res/drawable/ic_trust.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 11 | 12 | 15 | -------------------------------------------------------------------------------- /lineage/res/res/drawable/ic_trust_notification_manage.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 11 | 12 | 15 | -------------------------------------------------------------------------------- /lineage/res/res/drawable/ic_warning.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 11 | 12 | 15 | 16 | -------------------------------------------------------------------------------- /lineage/res/res/drawable/stat_sys_network_traffic_down.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 11 | 12 | 16 | 17 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /lineage/res/res/drawable/stat_sys_network_traffic_up.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 11 | 12 | 16 | 17 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /lineage/res/res/drawable/stat_sys_network_traffic_updown.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 11 | 12 | 16 | 17 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /lineage/res/res/mipmap-anydpi/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /lineage/res/res/values-af/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | verander stelsel profiele 9 | Laat \'n toep toe om stelsel profiele te verander. 10 | gebruik hardeware raamwerk 11 | Normaal 12 | Werk 13 | Tuis 14 | Stil 15 | Nag 16 | Motor 17 | Foon 18 | Kalender 19 | Gmail 20 | Epos 21 | SMS 22 | Ander 23 | Outomaties 24 | Kleurtemperatuur van die skerm sal outomaties aanpas na sononder en sonop 25 | Af 26 | Skakel al die aanpassings af 27 | Dag 28 | Gebruik dag instellings alleenlik 29 | Nag 30 | Gebruik nag instellings alleenlik 31 | Buitekant (helder son) 32 | Gebruik buite instellings alleenlik 33 | LewendigeVertoning kan jou oogspanning verminder en help jou slaap in die nag. Klik hier om dit uit te probeer! 34 | LiveDisplay af. 35 | LiveDisplay: outo modus. 36 | LiveDisplay: dag modus. 37 | LiveDisplay: nag modus. 38 | LiveDisplay: buitelug modus. 39 | LiveDisplay afgeskakel. 40 | LiveDisplay verander na outo modus. 41 | LiveDisplay verander na dag modus. 42 | LiveDisplay verander na nag modus. 43 | LiveDisplay verander na buitelug modus. 44 | bestuur LiveDisplay instellings 45 | Laat \'n toep toe om gevorderde skerm instellings te konfigureer. 46 | bestuur afgeleë opsies 47 | Laat \'n toepassing toe om afgeleë opsies te bestuur 48 | 49 | -------------------------------------------------------------------------------- /lineage/res/res/values-as/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | ছিষ্টেম প্ৰ\'ফাইল সংশোধন কৰক 9 | এটা এপ্প্‌ক ছিষ্টেম প্ৰ\'ফাইল সংশোধন কৰিবলৈ অনুমতি দিয়ে 10 | হাৰ্ডৱেৰ ফ্ৰেমৱৰ্ক ব্যৱহাৰ কৰক 11 | ডিফল্ট 12 | কৰ্ম 13 | হোম 14 | ছাইলেণ্ট 15 | নাইট 16 | অট\'ম\'বাইল 17 | ফোন 18 | কেলেণ্ডাৰ 19 | জিমেইল 20 | ইমেইল 21 | SMS 22 | অন্যান্য 23 | স্বয়ংক্ৰিয় 24 | সূৰ্যাস্ত আৰু সূৰ্যোদয়ৰ পাছত স্বয়ংক্ৰিয়ভাবে স্ক্ৰীণৰ ৰং তাপমাত্ৰা মিলাওক। 25 | অফ 26 | সকলো সমাযোজন অক্ষম কৰক 27 | দিন 28 | কেৱল দিনৰ ছেটিংচ ব্যৱহাৰ কৰক 29 | নাইট 30 | কেৱল ৰাতিৰ ছেটিংচ ব্যৱহাৰ কৰক 31 | আউটডোৰ (উজ্জ্বল ৰ\'দ) 32 | কেৱল আউটডোৰ ছেটিংচ ব্যৱহাৰ কৰক 33 | লাইভপ্রদর্শন আপোনাৰ চকুৰ ওপৰত চাপ কমাব পাৰে আৰু ৰাতি শোৱাত সহায় কৰিব পাৰে। ইয়াক চেষ্টা কৰি চাবলৈ ইয়াত ক্লিক কৰক! 34 | 35 | -------------------------------------------------------------------------------- /lineage/res/res/values-be/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | Сістэма LineageOS 9 | змена сістэмных профіляў 10 | Дазваляе праграме змяняць сістэмныя профілі. 11 | змяніць налады сістэмы Lineage 12 | Прадвызначана 13 | Праца 14 | Дом 15 | Без гуку 16 | Ноч 17 | Аўтамабіль 18 | Тэлефон 19 | Каляндар 20 | Gmail 21 | SMS 22 | Аўтаматычна 23 | Аўтаматычная карэкціроўка колеравай тэмпературы экрана пасля заходу і ўсходу сонца 24 | Адключыць усе карэкціроўкі 25 | Дзень 26 | Ноч 27 | LiveDisplay выключаны. 28 | LiveDisplay выключаны. 29 | LiveDisplay зменены на аўтаматычны рэжым. 30 | кіраванне наладамі LiveDisplay 31 | кіраваць аддаленымі наладамі 32 | Дазваляе праграме кіраваць аддаленымі наладамі 33 | Дата зборкі 34 | Абнаўленні LineageOS 35 | Версія LineageOS 36 | Невядома 37 | Праграма спынена 38 | кбіт/с 39 | Мбіт/с 40 | кБ/с 41 | МБ/с 42 | к 43 | М 44 | Trust 45 | доступ да інтэрфейсу Trust 46 | Trust \u2022 Бяспека сістэмы 47 | Даследуйце Trust 48 | 49 | -------------------------------------------------------------------------------- /lineage/res/res/values-eo/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | Tago 9 | 10 | -------------------------------------------------------------------------------- /lineage/res/res/values-es-rMX/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | Automático 9 | Ajustar automáticamente la temperatura del color de pantalla con el amanecer y el anochecer 10 | Apagar 11 | Desactivar todos los ajustes 12 | Día 13 | Utilizar solo los ajustes de día 14 | Utilizar solo los ajustes de noche 15 | Al aire libre (luz del sol) 16 | Utilizar solo los ajustes al aire libre 17 | LiveDisplay puede ayudar a reducir la fatiga visual y ayudarte a dormir por la noche. ¡Haz clic aquí para probarlo! 18 | 19 | -------------------------------------------------------------------------------- /lineage/res/res/values-gu/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | સિસ્ટમ પ્રોફાઇલ્સમાં ફેરફાર કરો 9 | ઍપને સિસ્ટમ પ્રોફાઇલ્સમાં ફેરફાર કરવાની પરવાનગી આપે છે. 10 | હાર્ડવેર ફ્રેમવર્કનો ઉપયોગ કરો 11 | ડિફોલ્ટ 12 | કાર્યાલય 13 | ઘર 14 | શાંત 15 | રાત્રિ 16 | ઓટોમોબાઇલ 17 | ફોન 18 | કૅલેન્ડર 19 | Gmail 20 | ઇમેઇલ 21 | SMS 22 | અન્ય 23 | સ્વચલિત 24 | સૂર્યોદય અને સૂર્યાસ્ત પછી સ્ક્રીનના રંગ તાપમાનને સ્વયંચાલિત રીતે સમાયોજિત કરો 25 | બંધ 26 | તમામ ફેરફારો અક્ષમ કરો 27 | દિવસ 28 | ફકત ડે સેટિંગ્સનો ઉપયોગ કરો 29 | રાત્રિ 30 | ફકત નાઇટ સેટિંગ્સનો ઉપયોગ કરો 31 | આઉટડોર (તેજ તડકો) 32 | ફકત આઉટડોર સેટિંગ્સનો ઉપયોગ કરો 33 | લાઇવડિસ્પ્લેથી આંખો પરની તાણ ઘટાડી શકાય છે અને તમને રાતે સૂવામાં મદદરૂપ થઈ શકે. અજમાવવા અહીં ક્લિક કરો! 34 | 35 | -------------------------------------------------------------------------------- /lineage/res/res/values-kab-rDZ/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | Anagraw n LineageOS 9 | snifel imaɣnuyen unagraw 10 | Sireg asnas ad-isnifel imaɣnuyen unagraw. 11 | Prédéfini(e) 12 | Axeddim 13 | Asebter agejdan 14 | Ulac sut 15 | Iḍ 16 | Takeṛṛust 17 | Tiliɣri 18 | Tasmektit 19 | Imayl 20 | Wayeḍ 21 | Awurman 22 | Insa 23 | Ass 24 | Iḍ 25 | Azemz n usefsu 26 | Aswir n LineageOS API 27 | Lqem n LineageOS 28 | Lqem n LineageOS 29 | Arussin 30 | Trust 31 | 32 | -------------------------------------------------------------------------------- /lineage/res/res/values-lb/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | Hardware-Framework benotzen 9 | Standard 10 | Aarbecht 11 | Doheem 12 | Roueg 13 | Nuecht 14 | Auto 15 | Telefon 16 | Kalenner 17 | Gmail 18 | E-Mail 19 | SMS 20 | Aner 21 | Aus 22 | Dag 23 | Nuecht 24 | 25 | -------------------------------------------------------------------------------- /lineage/res/res/values-lt/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | keisti sistemos profilius 9 | Leidžia programai keisti sistemos profilius. 10 | naudoti aparatinės įrangos sistemą 11 | Numatytasis 12 | Darbas 13 | Namai 14 | Tylus 15 | Naktis 16 | Automobilis 17 | Telefonas 18 | Kalendorius 19 | Gmail 20 | El. paštas 21 | SMS 22 | Kita 23 | Naktis 24 | 25 | -------------------------------------------------------------------------------- /lineage/res/res/values-ml/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | സിസ്റ്റം പ്രൊഫൈലുകൾ പരിഷ്ക്കരിക്കുക 9 | സിസ്റ്റം പ്രൊഫൈലുകൾ പരിഷ്കരിക്കുന്നതിന് ഒരു ആപ്ലിക്കേഷനെ അനുവദിക്കുന്നു. 10 | ഹാര്‍ഡ്‌വെയര്‍ ഫ്രെയിംവര്‍ക്ക് ഉപയോഗിക്കുക 11 | സ്ഥിരമായത് 12 | ഔദ്യോഗികവിലാസം 13 | ഹോം 14 | നിശബ്‌ദം 15 | രാത്രി 16 | ഓട്ടോമൊബൈല്‍ 17 | ഫോണ്‍ 18 | കലണ്ടർ 19 | ജി-മെയിൽ 20 | ഇമെയിൽ 21 | SMS 22 | മറ്റുള്ളവ 23 | യാന്ത്രികമായി 24 | സൂര്യാസ്തമയത്തിനും സൂര്യോദയത്തിനും ശേഷം സ്ക്രീനിന്റെ കളര്‍ താപനില സ്വയം ക്രമീകരിക്കുക 25 | ഓഫാണ് 26 | എല്ലാ ക്രമീകരണങ്ങളും അപ്രാപ്തമാക്കുക 27 | ദിവസം 28 | പകല്‍ ക്രമീകരണങ്ങൾ മാത്രം ഉപയോഗിക്കുക 29 | രാത്രി 30 | രാത്രി ക്രമീകരണങ്ങൾ മാത്രം ഉപയോഗിക്കുക 31 | ഔട്ട്ഡോർ (തെളിഞ്ഞ സൂര്യൻ) 32 | ഔട്ട്ഡോർ ക്രമീകരണങ്ങൾ മാത്രം ഉപയോഗിക്കുക 33 | ലൈവ്ഡിസ്പ്ലേ നിങ്ങളുടെ കണ്ണിന്റെ സമ്മര്‍ദ്ദം കുറയ്ക്കുകയും രാത്രി ഉറങ്ങാൻ നിങ്ങളെ സഹായിക്കുകയും ചെയ്യുന്നു. ഇത് പരീക്ഷിക്കാൻ ഇവിടെ ക്ലിക്ക് ചെയ്യുക! 34 | 35 | -------------------------------------------------------------------------------- /lineage/res/res/values-mr/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | सिस्टिम प्रोफाइल्स सुधारित करा 9 | अॅपला सिस्टिम प्रोफाइल्स सुधारित करण्याची परवानगी देते. 10 | हार्डवेअर फ्रेमवर्क वापरा 11 | डीफॉल्ट 12 | कार्य 13 | मुखपृष्ठ 14 | मूक 15 | रात्र 16 | मोटार 17 | फोन 18 | कॅलेंडर 19 | Gmail 20 | ईमेल करा 21 | SMS 22 | अन्य 23 | स्वयंचलित 24 | सूर्यास्त व सूर्योदयानंतर स्क्रीनचे रंग तापमान स्वयंचलितपणे समायोजित करा 25 | बंद 26 | सर्व समायोजने अक्षम करा 27 | दिवस 28 | केवळ दिवस सेटिंग्ज वापरा 29 | रात्र 30 | केवळ रात्र सेटिंग्ज वापरा 31 | आऊटडोअर (चमकदार सूर्य) 32 | केवळ आऊटडोअर सेटिंग्ज वापरा 33 | थेटप्रदर्शन डोळ्यांचा ताण कमी करण्यास मदत करते आणि तुम्हाला रात्री झोपण्यास मदत करते. ते वापरून पाहण्यासाठी इथे क्लिक करा! 34 | 35 | -------------------------------------------------------------------------------- /lineage/res/res/values-nb/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | endre system profiler 9 | Tillat en app å endre systemprofiler. 10 | bruk maskinvare framework 11 | Standard 12 | Arbeid 13 | Hjemme 14 | Lydløs 15 | Natt 16 | Bil 17 | Telefon 18 | Kalender 19 | Gmail 20 | E-post 21 | SMS 22 | Annet 23 | Automatisk 24 | Juster fargetemperatur på skjermen etter solnedgang og soloppgang 25 | Av 26 | Deaktivere alle justeringer 27 | Dag 28 | Bruk kun dag innstillinger 29 | Natt 30 | Bruk kun natt innstillinger 31 | Utendørs (sterkt sollys) 32 | Bruk kun utendørs innstillinger 33 | LiveDisplay kan redusere øyebelastning og redusere søvnvansker. Trykk her for å prøve det! 34 | LiveDisplay av. 35 | LiveDisplay: automatisk. 36 | LiveDisplay: dagmodus. 37 | LiveDisplay: natt modus. 38 | LiveDisplay: utendørs modus. 39 | LiveDisplay slått av. 40 | LiveDisplay endret til automatisk modus. 41 | LiveDisplay endret til dagsmodus. 42 | LiveDisplay endret til nattmodus. 43 | LiveDisplay endret til utendørs modus. 44 | behandle LiveDisplay innstillinger 45 | Tillater en app å konfigurere avanserte skjerminnstillinger. 46 | administrer fjernkontroll innstillinger 47 | Gir en app tilgang til å endre fjernkontroll innstillingene 48 | 49 | -------------------------------------------------------------------------------- /lineage/res/res/values-or/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | ସିଷ୍ଟମ୍‍ ପ୍ରୋଫାଇଲ୍‍ ସମ୍ପାଦନା କରନ୍ତୁ 9 | ସିଷ୍ଟମ୍‍ ପ୍ରୋଫାଇଲ୍‍ ସମ୍ପାଦନା କରିବାକୁ ଆପ୍ଲିକେସନ୍‍କୁ ଅନୁମତି ଦିଏ। 10 | ହାର୍ଡ୍‍ଓୟାର୍‍ ଫ୍ରେମ୍‍ୱାର୍କ୍‍ ବ୍ୟବହାର କରନ୍ତୁ 11 | ଡିଫଲ୍ଟ 12 | କାର୍ଯ୍ୟ 13 | ହୋମ୍ 14 | ଶାନ୍ତ 15 | ରାତ୍ରି 16 | ଅଟୋମୋବିଲ୍‌ 17 | ଫୋନ୍ 18 | କ୍ୟାଲେଣ୍ଡର୍ 19 | Gmail 20 | ଇମେଲ୍ 21 | SMS 22 | ଅନ୍ୟାନ୍ୟ 23 | ସ୍ୱତଃସ୍ପୃତ 24 | ସୂର୍ଯ୍ୟାସ୍ତ ଓ ସୂର୍ଯ୍ୟୋଦୟ ପରେ ରଙ୍ଗ ତାପମାତ୍ରା ସ୍ୱତଃ ଆଡ୍‍ଜଷ୍ଟ କରନ୍ତୁ 25 | ଅଫ୍ 26 | ସ୍ସମସ୍ତ ଆଡ୍‍ଜଷ୍ଟ୍ମେଣ୍ଟ ଅଷମ କରନ୍ତୁ 27 | ଦିନ 28 | କେବଳ ଦିନ ସେଟିଂସ୍‍ ବ୍ୟବହାର କରନ୍ତୁ 29 | ରାତ୍ରି 30 | କେବଳ ରାତ୍ରି ସେଟିଂସ୍‍ ବ୍ୟବହାର କରନ୍ତୁ 31 | ଆଉଟ୍‍ଡୋର୍‍ (ଟାଣ ଖରା) 32 | କେବଳ ଆଉଟ୍‍ଡୋର୍‍ ସେଟିଂସ୍‍ ବ୍ୟବହାର କରନ୍ତୁ 33 | ଲାଇଭ୍‍ଡିସ୍‍ପ୍ଲେ ଆଇଷ୍ଟ୍ରେନ୍‍ କମାଇବାରେ ଓ ରାତିରେ ଆପଣଙ୍କୁ ଶୋଇବାରେ ସାହାଯ୍ୟ କରିପାରେ। ଏହା ବ୍ୟବହାର କରିବା ପାଇଁ ଏଠାରେ କ୍ଲିକ୍‍ କରନ୍ତୁ! 34 | 35 | -------------------------------------------------------------------------------- /lineage/res/res/values-sc-rIT/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | Sistema LineageOS 9 | modìfica sos profilos de sistema 10 | Permitit a un\'aplicatzione de modificare sos profilos de sistema. 11 | modìfica sas impostatziones de sistema de Lineage 12 | Permitit a un\'aplicatzione de modificare sas impostatziones de sistema de Lineage. 13 | Predefinidu 14 | Traballu 15 | Domo 16 | Note 17 | Automòbile 18 | Telèfonu 19 | Calendàriu 20 | Gmail 21 | SMS 22 | Àteru 23 | Automàticu 24 | Acontza automaticamente sa temperadura de su colore de s\'ischermu a pustis de s\'arbèschida e de s\'intrinada 25 | Istudadu 26 | Disabìlita totu sos acontzos 27 | Die 28 | Imprea petzi sas impostatziones pro sa die 29 | Note 30 | Imprea petzi sas impostatziones pro sa note 31 | In foras (lughe de su sole) 32 | Imprea petzi sas impostatziones pro istare in foras 33 | LiveDisplay istudadu. 34 | LiveDisplay: modalidade automàtica. 35 | LiveDisplay: modalidade pro sa die. 36 | LiveDisplay: modalidade pro sa note. 37 | LiveDisplay: modalidade a s\'àera aberta. 38 | LiveDisplay istudadu. 39 | LiveDisplay: cambiadu in modalidade automàtica. 40 | LiveDisplay: cambiadu in modalidade pro sa die. 41 | LiveDisplay: cambiadu in modalidade pro sa note. 42 | LiveDisplay: cambiadu in modalidade a s\'àera aberta. 43 | Livellu de s\'API de LineageOS 44 | Disconnotu 45 | Sa bateria at a èssere carrigada de su totu a su %1$s 46 | 47 | -------------------------------------------------------------------------------- /lineage/res/res/values-sw600dp/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | true 20 | 21 | -------------------------------------------------------------------------------- /lineage/res/res/values-te/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | సిస్టమ్ ప్రొఫైళ్ళను సవరించుము 9 | సిస్టమ్ ప్రొఫైళ్ళను సవరించేందుకు ప్రోగ్రాంకి అనుమతినిస్తుంది. 10 | వినియోగదారు హార్డ్‌వేర్‌ ఫ్రేమ్‌వర్క్ 11 | డిఫాల్ట్ 12 | కార్యాలయం 13 | హోమ్ 14 | నిశ్శబ్దం 15 | రాత్రి 16 | ఆటోమొబైల్ 17 | ఫోన్ 18 | క్యాలెండర్ 19 | Gmail 20 | ఈమెయిల్‌ 21 | SMS 22 | ఇతరం 23 | స్వయంచాలకం 24 | సూర్యాస్తమయం మరియు సూర్యోదయం తరువాత స్వయంచాలకంగా స్క్రీన్ యొక్క వర్ణ ఉష్ణోగ్రతను సవరించుము. 25 | ఆఫ్‌లో ఉంది 26 | అన్ని సవరణలను నిలిపివేయుము 27 | పగలు 28 | పగటి సెట్టింగులను మాత్రమే ఉపయోగించుము 29 | రాత్రి 30 | రాత్రి సెట్టింగులను మాత్రమే ఉపయోగించుము 31 | ఆరుబయట (ప్రకాశవంతమైన సూర్యుడు) 32 | ఆరుబయటి సెట్టింగులను మాత్రమే ఉపయోగించుము 33 | ప్రత్యక్ష ప్రదర్శన మీ కంటిపై ఒత్తిడిని తగ్గించడానికి సహాయపడుతుంది మరియు రాత్రి సమయంలో నిద్రపోవడానికి సహకరిస్తుంది. దానిని ప్రయత్నించి చూడడానికి ఇక్కడ క్లిక్ చేయండి! 34 | 35 | -------------------------------------------------------------------------------- /lineage/res/res/values-ug/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | سىستېما سەپلەنمىسىنى ئۆزگەرتىش 9 | ئەپنىڭ سىستېما سەپلەنمىسىنى ئۆزگەرتىشىگە يول قويۇش. 10 | قاتتىق دىتال جازىسىنى ئىشلىتىش 11 | كۆڭۈلدىكى 12 | ئىش 13 | باش ئېكران 14 | ئۈنسىز 15 | كېچە 16 | ئاپتوموبىل 17 | تېلېفون 18 | كالېندار 19 | Gmail 20 | ئېلخەت 21 | قىسقا ئۇچۇر 22 | باشقا 23 | ئاپتوماتېك 24 | كۈن چىققان ۋە كۈن پاتقاندىن كېيىن ئېكران رەڭ تېمپېراتورىسىنى ئۆزلۈكىدىن تەڭشەيدۇ 25 | تاقاق 26 | بارلىق تەڭشەشلەرنى چەكلەيدۇ 27 | كۈن 28 | كۈندۈز تەڭشەكلىرىنىلا ئىشلىتىدۇ 29 | كېچە 30 | كېچە تەڭشەكلىرىنىلا ئىشلىتىدۇ 31 | تالا (قۇياش نۇرى) 32 | تالا تەڭشەكلىرىنىلا ئىشلىتىدۇ 33 | LiveDisplay كۆز چارچىشىنى يېنىكلىتىشكە ياردەم بېرىدۇ، كېچىدە ئۇخلىشىڭىزغا ياردەم بېرىدۇ. سىناش ئۈچۈن بۇ جاينى چېكىڭ! 34 | 35 | -------------------------------------------------------------------------------- /lineage/res/res/values-zh-rHK/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 使用硬件框架 9 | 靜音 10 | 11 | -------------------------------------------------------------------------------- /lineage/res/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | #FF5630 9 | 10 | -------------------------------------------------------------------------------- /lineage/res/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 14sp 9 | 8sp 10 | 11 | -------------------------------------------------------------------------------- /lineage/res/res/xml/profile_default.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | normal 12 | true 13 | 14 | 15 | 18 | 19 | mute 20 | true 21 | 22 | 23 | 26 | 27 | 28 | 4 29 | 1 30 | true 31 | 32 | 33 | 34 | 7 35 | 1 36 | true 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /packages/LineagePreferenceLib/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // SPDX-FileCopyrightText: 2022 The LineageOS Project 3 | // SPDX-License-Identifier: Apache-2.0 4 | // 5 | 6 | android_library { 7 | name: "LineagePreferenceLib", 8 | min_sdk_version: "30", 9 | static_libs: [ 10 | "androidx.preference_preference", 11 | "SettingsLibMainSwitchPreference", 12 | "org.lineageos.platform", 13 | ], 14 | 15 | srcs: ["java/**/*.java"], 16 | resource_dirs: ["res"], 17 | 18 | aidl: { 19 | local_include_dirs: ["java"], 20 | }, 21 | } 22 | -------------------------------------------------------------------------------- /packages/LineagePreferenceLib/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 8 | -------------------------------------------------------------------------------- /packages/LineagePreferenceLib/java/lineageos/preference/GlobalSettingMainSwitchPreference.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2021 The LineageOS Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package lineageos.preference; 7 | 8 | import android.content.Context; 9 | import android.provider.Settings; 10 | import android.util.AttributeSet; 11 | 12 | import androidx.preference.PreferenceDataStore; 13 | 14 | import com.android.settingslib.widget.MainSwitchPreference; 15 | 16 | public class GlobalSettingMainSwitchPreference extends MainSwitchPreference { 17 | 18 | public GlobalSettingMainSwitchPreference(Context context, AttributeSet attrs, int defStyle) { 19 | super(context, attrs, defStyle); 20 | setPreferenceDataStore(new DataStore()); 21 | } 22 | 23 | public GlobalSettingMainSwitchPreference(Context context, AttributeSet attrs) { 24 | super(context, attrs); 25 | setPreferenceDataStore(new DataStore()); 26 | } 27 | 28 | public GlobalSettingMainSwitchPreference(Context context) { 29 | super(context, null); 30 | setPreferenceDataStore(new DataStore()); 31 | } 32 | 33 | private class DataStore extends PreferenceDataStore { 34 | @Override 35 | public void putBoolean(String key, boolean value) { 36 | Settings.Global.putInt(getContext().getContentResolver(), key, value ? 1 : 0); 37 | } 38 | 39 | @Override 40 | public boolean getBoolean(String key, boolean defaultValue) { 41 | return Settings.Global.getInt(getContext().getContentResolver(), key, 42 | defaultValue ? 1 : 0) != 0; 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /packages/LineagePreferenceLib/java/lineageos/preference/GlobalSettingSwitchPreference.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2014-2016 The CyanogenMod Project 3 | * SPDX-FileCopyrightText: 2018 The LineageOS Project 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package lineageos.preference; 8 | 9 | import android.content.Context; 10 | import android.provider.Settings; 11 | import android.util.AttributeSet; 12 | 13 | public class GlobalSettingSwitchPreference extends SelfRemovingSwitchPreference { 14 | 15 | public GlobalSettingSwitchPreference(Context context, AttributeSet attrs, int defStyle) { 16 | super(context, attrs, defStyle); 17 | } 18 | 19 | public GlobalSettingSwitchPreference(Context context, AttributeSet attrs) { 20 | super(context, attrs); 21 | } 22 | 23 | public GlobalSettingSwitchPreference(Context context) { 24 | super(context, null); 25 | } 26 | 27 | @Override 28 | protected boolean isPersisted() { 29 | return Settings.Global.getString(getContext().getContentResolver(), getKey()) != null; 30 | } 31 | 32 | @Override 33 | protected void putBoolean(String key, boolean value) { 34 | Settings.Global.putInt(getContext().getContentResolver(), key, value ? 1 : 0); 35 | } 36 | 37 | @Override 38 | protected boolean getBoolean(String key, boolean defaultValue) { 39 | return Settings.Global.getInt(getContext().getContentResolver(), 40 | key, defaultValue ? 1 : 0) != 0; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /packages/LineagePreferenceLib/java/lineageos/preference/LineageGlobalSettingListPreference.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2022 The LineageOS Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package lineageos.preference; 7 | 8 | import android.content.Context; 9 | import android.util.AttributeSet; 10 | 11 | import lineageos.providers.LineageSettings; 12 | 13 | public class LineageGlobalSettingListPreference extends SelfRemovingListPreference { 14 | 15 | public LineageGlobalSettingListPreference(Context context, AttributeSet attrs, int defStyle) { 16 | super(context, attrs, defStyle); 17 | } 18 | 19 | public LineageGlobalSettingListPreference(Context context, AttributeSet attrs) { 20 | super(context, attrs); 21 | } 22 | 23 | public int getIntValue(int defValue) { 24 | return getValue() == null ? defValue : Integer.valueOf(getValue()); 25 | } 26 | 27 | @Override 28 | protected boolean isPersisted() { 29 | return LineageSettings.Global.getString(getContext().getContentResolver(), 30 | getKey()) != null; 31 | } 32 | 33 | @Override 34 | protected void putString(String key, String value) { 35 | LineageSettings.Global.putString(getContext().getContentResolver(), key, value); 36 | } 37 | 38 | @Override 39 | protected String getString(String key, String defaultValue) { 40 | return LineageSettings.Global.getString(getContext().getContentResolver(), 41 | key, defaultValue); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /packages/LineagePreferenceLib/java/lineageos/preference/LineageGlobalSettingMainSwitchPreference.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2021 The LineageOS Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package lineageos.preference; 7 | 8 | import android.content.Context; 9 | import android.util.AttributeSet; 10 | 11 | import androidx.preference.PreferenceDataStore; 12 | 13 | import com.android.settingslib.widget.MainSwitchPreference; 14 | 15 | import lineageos.providers.LineageSettings; 16 | 17 | public class LineageGlobalSettingMainSwitchPreference extends MainSwitchPreference { 18 | 19 | public LineageGlobalSettingMainSwitchPreference(Context context, AttributeSet attrs, 20 | int defStyle) { 21 | super(context, attrs, defStyle); 22 | setPreferenceDataStore(new DataStore()); 23 | } 24 | 25 | public LineageGlobalSettingMainSwitchPreference(Context context, AttributeSet attrs) { 26 | super(context, attrs); 27 | setPreferenceDataStore(new DataStore()); 28 | } 29 | 30 | public LineageGlobalSettingMainSwitchPreference(Context context) { 31 | super(context); 32 | setPreferenceDataStore(new DataStore()); 33 | } 34 | 35 | private class DataStore extends PreferenceDataStore { 36 | @Override 37 | public void putBoolean(String key, boolean value) { 38 | LineageSettings.Global.putInt(getContext().getContentResolver(), key, value ? 1 : 0); 39 | } 40 | 41 | @Override 42 | public boolean getBoolean(String key, boolean defaultValue) { 43 | return LineageSettings.Global.getInt(getContext().getContentResolver(), key, 44 | defaultValue ? 1 : 0) != 0; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /packages/LineagePreferenceLib/java/lineageos/preference/LineageGlobalSettingSwitchPreference.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2016 The CyanogenMod Project 3 | * SPDX-FileCopyrightText: 2018 The LineageOS Project 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package lineageos.preference; 8 | 9 | import android.content.Context; 10 | import android.util.AttributeSet; 11 | 12 | import lineageos.providers.LineageSettings; 13 | 14 | public class LineageGlobalSettingSwitchPreference extends SelfRemovingSwitchPreference { 15 | 16 | public LineageGlobalSettingSwitchPreference(Context context, AttributeSet attrs, int defStyle) { 17 | super(context, attrs, defStyle); 18 | } 19 | 20 | public LineageGlobalSettingSwitchPreference(Context context, AttributeSet attrs) { 21 | super(context, attrs); 22 | } 23 | 24 | public LineageGlobalSettingSwitchPreference(Context context) { 25 | super(context); 26 | } 27 | 28 | @Override 29 | protected boolean isPersisted() { 30 | return LineageSettings.Global.getString(getContext().getContentResolver(), getKey()) != null; 31 | } 32 | 33 | @Override 34 | protected void putBoolean(String key, boolean value) { 35 | LineageSettings.Global.putInt(getContext().getContentResolver(), key, value ? 1 : 0); 36 | } 37 | 38 | @Override 39 | protected boolean getBoolean(String key, boolean defaultValue) { 40 | return LineageSettings.Global.getInt(getContext().getContentResolver(), 41 | key, defaultValue ? 1 : 0) != 0; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /packages/LineagePreferenceLib/java/lineageos/preference/LineagePartsPreference.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2016 The CyanogenMod Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | package lineageos.preference; 6 | 7 | import android.content.Context; 8 | import android.os.Bundle; 9 | import android.util.AttributeSet; 10 | 11 | /** 12 | * A link to a remote preference screen which can be used with a minimum amount 13 | * of information. Supports summary updates asynchronously. 14 | */ 15 | public class LineagePartsPreference extends RemotePreference { 16 | 17 | private static final String TAG = "LineagePartsPreference"; 18 | 19 | private final PartInfo mPart; 20 | 21 | private final Context mContext; 22 | 23 | public LineagePartsPreference(Context context, AttributeSet attrs, 24 | int defStyle, int defStyleRes) { 25 | super(context, attrs, defStyle, defStyleRes); 26 | mContext = context; 27 | mPart = PartsList.get(context).getPartInfo(getKey()); 28 | if (mPart == null) { 29 | throw new RuntimeException("Part not found: " + getKey()); 30 | } 31 | 32 | updatePreference(); 33 | setIntent(mPart.getIntentForActivity()); 34 | } 35 | 36 | public LineagePartsPreference(Context context, AttributeSet attrs, int defStyle) { 37 | this(context, attrs, defStyle, 0); 38 | } 39 | 40 | public LineagePartsPreference(Context context, AttributeSet attrs) { 41 | this(context, attrs, androidx.preference.R.attr.preferenceStyle); 42 | } 43 | 44 | @Override 45 | public void onRemoteUpdated(Bundle bundle) { 46 | if (bundle.containsKey(PartsList.EXTRA_PART)) { 47 | PartInfo update = bundle.getParcelable(PartsList.EXTRA_PART); 48 | if (update != null) { 49 | mPart.updateFrom(update); 50 | updatePreference(); 51 | } 52 | } 53 | } 54 | 55 | @Override 56 | protected String getRemoteKey(Bundle metaData) { 57 | // remote key is the same as ours 58 | return getKey(); 59 | } 60 | 61 | private void updatePreference() { 62 | if (isAvailable() != mPart.isAvailable()) { 63 | setAvailable(mPart.isAvailable()); 64 | } 65 | if (isAvailable()) { 66 | setTitle(mPart.getTitle()); 67 | setSummary(mPart.getSummary()); 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /packages/LineagePreferenceLib/java/lineageos/preference/LineageSecureSettingListPreference.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2016 The CyanogenMod Project 3 | * SPDX-FileCopyrightText: 2018 The LineageOS Project 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | package lineageos.preference; 7 | 8 | import android.content.Context; 9 | import android.util.AttributeSet; 10 | 11 | import lineageos.providers.LineageSettings; 12 | 13 | public class LineageSecureSettingListPreference extends SelfRemovingListPreference { 14 | 15 | public LineageSecureSettingListPreference(Context context, AttributeSet attrs, int defStyle) { 16 | super(context, attrs, defStyle); 17 | } 18 | 19 | public LineageSecureSettingListPreference(Context context, AttributeSet attrs) { 20 | super(context, attrs); 21 | } 22 | 23 | public int getIntValue(int defValue) { 24 | return getValue() == null ? defValue : Integer.valueOf(getValue()); 25 | } 26 | 27 | @Override 28 | protected boolean isPersisted() { 29 | return LineageSettings.Secure.getString(getContext().getContentResolver(), getKey()) != null; 30 | } 31 | 32 | @Override 33 | protected void putString(String key, String value) { 34 | LineageSettings.Secure.putString(getContext().getContentResolver(), key, value); 35 | } 36 | 37 | @Override 38 | protected String getString(String key, String defaultValue) { 39 | return LineageSettings.Secure.getString(getContext().getContentResolver(), 40 | key, defaultValue); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /packages/LineagePreferenceLib/java/lineageos/preference/LineageSecureSettingMainSwitchPreference.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2021 The LineageOS Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package lineageos.preference; 7 | 8 | import android.content.Context; 9 | import android.util.AttributeSet; 10 | 11 | import androidx.preference.PreferenceDataStore; 12 | 13 | import com.android.settingslib.widget.MainSwitchPreference; 14 | 15 | import lineageos.providers.LineageSettings; 16 | 17 | public class LineageSecureSettingMainSwitchPreference extends MainSwitchPreference { 18 | 19 | public LineageSecureSettingMainSwitchPreference(Context context, AttributeSet attrs, 20 | int defStyle) { 21 | super(context, attrs, defStyle); 22 | setPreferenceDataStore(new DataStore()); 23 | } 24 | 25 | public LineageSecureSettingMainSwitchPreference(Context context, AttributeSet attrs) { 26 | super(context, attrs); 27 | setPreferenceDataStore(new DataStore()); 28 | } 29 | 30 | public LineageSecureSettingMainSwitchPreference(Context context) { 31 | super(context); 32 | setPreferenceDataStore(new DataStore()); 33 | } 34 | 35 | private class DataStore extends PreferenceDataStore { 36 | @Override 37 | public void putBoolean(String key, boolean value) { 38 | LineageSettings.Secure.putInt(getContext().getContentResolver(), key, value ? 1 : 0); 39 | } 40 | 41 | @Override 42 | public boolean getBoolean(String key, boolean defaultValue) { 43 | return LineageSettings.Secure.getInt(getContext().getContentResolver(), key, 44 | defaultValue ? 1 : 0) != 0; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /packages/LineagePreferenceLib/java/lineageos/preference/LineageSecureSettingSwitchPreference.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2015 The CyanogenMod Project 3 | * SPDX-FileCopyrightText: 2018 The LineageOS Project 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package lineageos.preference; 8 | 9 | import android.content.Context; 10 | import android.util.AttributeSet; 11 | 12 | import lineageos.providers.LineageSettings; 13 | 14 | public class LineageSecureSettingSwitchPreference extends SelfRemovingSwitchPreference { 15 | 16 | public LineageSecureSettingSwitchPreference(Context context, AttributeSet attrs, int defStyle) { 17 | super(context, attrs, defStyle); 18 | } 19 | 20 | public LineageSecureSettingSwitchPreference(Context context, AttributeSet attrs) { 21 | super(context, attrs); 22 | } 23 | 24 | public LineageSecureSettingSwitchPreference(Context context) { 25 | super(context); 26 | } 27 | 28 | @Override 29 | protected boolean isPersisted() { 30 | return LineageSettings.Secure.getString(getContext().getContentResolver(), getKey()) != null; 31 | } 32 | 33 | @Override 34 | protected void putBoolean(String key, boolean value) { 35 | LineageSettings.Secure.putInt(getContext().getContentResolver(), key, value ? 1 : 0); 36 | } 37 | 38 | @Override 39 | protected boolean getBoolean(String key, boolean defaultValue) { 40 | return LineageSettings.Secure.getInt(getContext().getContentResolver(), 41 | key, defaultValue ? 1 : 0) != 0; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /packages/LineagePreferenceLib/java/lineageos/preference/LineageSystemSettingDropDownPreference.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2016 The CyanogenMod Project 3 | * SPDX-FileCopyrightText: 2018 The LineageOS Project 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | package lineageos.preference; 7 | 8 | import android.content.Context; 9 | import android.util.AttributeSet; 10 | 11 | import lineageos.providers.LineageSettings; 12 | 13 | public class LineageSystemSettingDropDownPreference extends SelfRemovingDropDownPreference { 14 | public LineageSystemSettingDropDownPreference(Context context, AttributeSet attrs, int defStyle) { 15 | super(context, attrs, defStyle); 16 | } 17 | 18 | public LineageSystemSettingDropDownPreference(Context context, AttributeSet attrs) { 19 | super(context, attrs); 20 | } 21 | 22 | public int getIntValue(int defValue) { 23 | return getValue() == null ? defValue : Integer.valueOf(getValue()); 24 | } 25 | 26 | @Override 27 | protected boolean isPersisted() { 28 | return LineageSettings.System.getString(getContext().getContentResolver(), getKey()) != null; 29 | } 30 | 31 | @Override 32 | protected void putString(String key, String value) { 33 | LineageSettings.System.putString(getContext().getContentResolver(), key, value); 34 | } 35 | 36 | @Override 37 | protected String getString(String key, String defaultValue) { 38 | return LineageSettings.System.getString(getContext().getContentResolver(), 39 | key, defaultValue); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /packages/LineagePreferenceLib/java/lineageos/preference/LineageSystemSettingListPreference.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2016 The CyanogenMod Project 3 | * SPDX-FileCopyrightText: 2018 The LineageOS Project 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | package lineageos.preference; 7 | 8 | import android.content.Context; 9 | import android.util.AttributeSet; 10 | 11 | import lineageos.providers.LineageSettings; 12 | 13 | public class LineageSystemSettingListPreference extends SelfRemovingListPreference { 14 | public LineageSystemSettingListPreference(Context context, AttributeSet attrs, int defStyle) { 15 | super(context, attrs, defStyle); 16 | } 17 | 18 | public LineageSystemSettingListPreference(Context context, AttributeSet attrs) { 19 | super(context, attrs); 20 | } 21 | 22 | public int getIntValue(int defValue) { 23 | return getValue() == null ? defValue : Integer.valueOf(getValue()); 24 | } 25 | 26 | @Override 27 | protected boolean isPersisted() { 28 | return LineageSettings.System.getString(getContext().getContentResolver(), getKey()) != null; 29 | } 30 | 31 | @Override 32 | protected void putString(String key, String value) { 33 | LineageSettings.System.putString(getContext().getContentResolver(), key, value); 34 | } 35 | 36 | @Override 37 | protected String getString(String key, String defaultValue) { 38 | return LineageSettings.System.getString(getContext().getContentResolver(), 39 | key, defaultValue); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /packages/LineagePreferenceLib/java/lineageos/preference/LineageSystemSettingMainSwitchPreference.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2021 The LineageOS Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package lineageos.preference; 7 | 8 | import android.content.Context; 9 | import android.util.AttributeSet; 10 | 11 | import androidx.preference.PreferenceDataStore; 12 | 13 | import com.android.settingslib.widget.MainSwitchPreference; 14 | 15 | import lineageos.providers.LineageSettings; 16 | 17 | public class LineageSystemSettingMainSwitchPreference extends MainSwitchPreference { 18 | 19 | public LineageSystemSettingMainSwitchPreference(Context context, AttributeSet attrs, 20 | int defStyle) { 21 | super(context, attrs, defStyle); 22 | setPreferenceDataStore(new DataStore()); 23 | } 24 | 25 | public LineageSystemSettingMainSwitchPreference(Context context, AttributeSet attrs) { 26 | super(context, attrs); 27 | setPreferenceDataStore(new DataStore()); 28 | } 29 | 30 | public LineageSystemSettingMainSwitchPreference(Context context) { 31 | super(context); 32 | setPreferenceDataStore(new DataStore()); 33 | } 34 | 35 | private class DataStore extends PreferenceDataStore { 36 | @Override 37 | public void putBoolean(String key, boolean value) { 38 | LineageSettings.System.putInt(getContext().getContentResolver(), key, value ? 1 : 0); 39 | } 40 | 41 | @Override 42 | public boolean getBoolean(String key, boolean defaultValue) { 43 | return LineageSettings.System.getInt(getContext().getContentResolver(), key, 44 | defaultValue ? 1 : 0) != 0; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /packages/LineagePreferenceLib/java/lineageos/preference/LineageSystemSettingSwitchPreference.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2015 The CyanogenMod Project 3 | * SPDX-FileCopyrightText: 2018 The LineageOS Project 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package lineageos.preference; 8 | 9 | import android.content.Context; 10 | import android.util.AttributeSet; 11 | 12 | import lineageos.providers.LineageSettings; 13 | 14 | public class LineageSystemSettingSwitchPreference extends SelfRemovingSwitchPreference { 15 | 16 | public LineageSystemSettingSwitchPreference(Context context, AttributeSet attrs, int defStyle) { 17 | super(context, attrs, defStyle); 18 | } 19 | 20 | public LineageSystemSettingSwitchPreference(Context context, AttributeSet attrs) { 21 | super(context, attrs); 22 | } 23 | 24 | public LineageSystemSettingSwitchPreference(Context context) { 25 | super(context); 26 | } 27 | 28 | @Override 29 | protected boolean isPersisted() { 30 | return LineageSettings.System.getString(getContext().getContentResolver(), getKey()) != null; 31 | } 32 | 33 | @Override 34 | protected void putBoolean(String key, boolean value) { 35 | LineageSettings.System.putInt(getContext().getContentResolver(), key, value ? 1 : 0); 36 | } 37 | 38 | @Override 39 | protected boolean getBoolean(String key, boolean defaultValue) { 40 | return LineageSettings.System.getInt(getContext().getContentResolver(), 41 | key, defaultValue ? 1 : 0) != 0; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /packages/LineagePreferenceLib/java/lineageos/preference/PartInfo.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2016 The CyanogenMod Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package lineageos.preference; 7 | 8 | parcelable PartInfo; 9 | -------------------------------------------------------------------------------- /packages/LineagePreferenceLib/java/lineageos/preference/SecureSettingMainSwitchPreference.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2021 The LineageOS Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package lineageos.preference; 7 | 8 | import android.content.Context; 9 | import android.provider.Settings; 10 | import android.util.AttributeSet; 11 | 12 | import androidx.preference.PreferenceDataStore; 13 | 14 | import com.android.settingslib.widget.MainSwitchPreference; 15 | 16 | public class SecureSettingMainSwitchPreference extends MainSwitchPreference { 17 | 18 | public SecureSettingMainSwitchPreference(Context context, AttributeSet attrs, int defStyle) { 19 | super(context, attrs, defStyle); 20 | setPreferenceDataStore(new DataStore()); 21 | } 22 | 23 | public SecureSettingMainSwitchPreference(Context context, AttributeSet attrs) { 24 | super(context, attrs); 25 | setPreferenceDataStore(new DataStore()); 26 | } 27 | 28 | public SecureSettingMainSwitchPreference(Context context) { 29 | super(context, null); 30 | setPreferenceDataStore(new DataStore()); 31 | } 32 | 33 | private class DataStore extends PreferenceDataStore { 34 | @Override 35 | public void putBoolean(String key, boolean value) { 36 | Settings.Secure.putInt(getContext().getContentResolver(), key, value ? 1 : 0); 37 | } 38 | 39 | @Override 40 | public boolean getBoolean(String key, boolean defaultValue) { 41 | return Settings.Secure.getInt(getContext().getContentResolver(), key, 42 | defaultValue ? 1 : 0) != 0; 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /packages/LineagePreferenceLib/java/lineageos/preference/SecureSettingSwitchPreference.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2014-2016 The CyanogenMod Project 3 | * SPDX-FileCopyrightText: 2018 The LineageOS Project 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package lineageos.preference; 8 | 9 | import android.content.Context; 10 | import android.provider.Settings; 11 | import android.util.AttributeSet; 12 | 13 | public class SecureSettingSwitchPreference extends SelfRemovingSwitchPreference { 14 | 15 | public SecureSettingSwitchPreference(Context context, AttributeSet attrs, int defStyle) { 16 | super(context, attrs, defStyle); 17 | } 18 | 19 | public SecureSettingSwitchPreference(Context context, AttributeSet attrs) { 20 | super(context, attrs); 21 | } 22 | 23 | public SecureSettingSwitchPreference(Context context) { 24 | super(context, null); 25 | } 26 | 27 | @Override 28 | protected boolean isPersisted() { 29 | return Settings.Secure.getString(getContext().getContentResolver(), getKey()) != null; 30 | } 31 | 32 | @Override 33 | protected void putBoolean(String key, boolean value) { 34 | Settings.Secure.putInt(getContext().getContentResolver(), key, value ? 1 : 0); 35 | } 36 | 37 | @Override 38 | protected boolean getBoolean(String key, boolean defaultValue) { 39 | return Settings.Secure.getInt(getContext().getContentResolver(), 40 | key, defaultValue ? 1 : 0) != 0; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /packages/LineagePreferenceLib/java/lineageos/preference/SelfRemovingDropDownPreference.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2016 The CyanogenMod Project 3 | * SPDX-FileCopyrightText: 2018 The LineageOS Project 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | package lineageos.preference; 7 | 8 | import android.content.Context; 9 | import android.util.AttributeSet; 10 | 11 | import androidx.preference.DropDownPreference; 12 | import androidx.preference.PreferenceDataStore; 13 | import androidx.preference.PreferenceViewHolder; 14 | 15 | /** 16 | * A Preference which can automatically remove itself from the hierarchy 17 | * based on constraints set in XML. 18 | */ 19 | public abstract class SelfRemovingDropDownPreference extends DropDownPreference { 20 | 21 | private final ConstraintsHelper mConstraints; 22 | 23 | public SelfRemovingDropDownPreference(Context context, AttributeSet attrs, int defStyle) { 24 | super(context, attrs, defStyle); 25 | mConstraints = new ConstraintsHelper(context, attrs, this); 26 | setPreferenceDataStore(new DataStore()); 27 | } 28 | 29 | public SelfRemovingDropDownPreference(Context context, AttributeSet attrs) { 30 | super(context, attrs); 31 | mConstraints = new ConstraintsHelper(context, attrs, this); 32 | setPreferenceDataStore(new DataStore()); 33 | } 34 | 35 | public SelfRemovingDropDownPreference(Context context) { 36 | super(context); 37 | mConstraints = new ConstraintsHelper(context, null, this); 38 | setPreferenceDataStore(new DataStore()); 39 | } 40 | 41 | @Override 42 | public void onAttached() { 43 | super.onAttached(); 44 | mConstraints.onAttached(); 45 | } 46 | 47 | @Override 48 | public void onBindViewHolder(PreferenceViewHolder holder) { 49 | super.onBindViewHolder(holder); 50 | mConstraints.onBindViewHolder(holder); 51 | } 52 | 53 | public void setAvailable(boolean available) { 54 | mConstraints.setAvailable(available); 55 | } 56 | 57 | public boolean isAvailable() { 58 | return mConstraints.isAvailable(); 59 | } 60 | 61 | protected abstract boolean isPersisted(); 62 | protected abstract void putString(String key, String value); 63 | protected abstract String getString(String key, String defaultValue); 64 | 65 | @Override 66 | protected void onSetInitialValue(boolean restorePersistedValue, Object defaultValue) { 67 | final String value; 68 | if (!restorePersistedValue || !isPersisted()) { 69 | if (defaultValue == null) { 70 | return; 71 | } 72 | value = (String) defaultValue; 73 | if (shouldPersist()) { 74 | persistString(value); 75 | } 76 | } else { 77 | // Note: the default is not used because to have got here 78 | // isPersisted() must be true. 79 | value = getString(getKey(), null /* not used */); 80 | } 81 | setValue(value); 82 | } 83 | 84 | private class DataStore extends PreferenceDataStore { 85 | @Override 86 | public void putString(String key, String value) { 87 | SelfRemovingDropDownPreference.this.putString(key, value); 88 | } 89 | 90 | @Override 91 | public String getString(String key, String defaultValue) { 92 | return SelfRemovingDropDownPreference.this.getString(key, defaultValue); 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /packages/LineagePreferenceLib/java/lineageos/preference/SelfRemovingListPreference.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2016 The CyanogenMod Project 3 | * SPDX-FileCopyrightText: 2018 The LineageOS Project 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | package lineageos.preference; 7 | 8 | import android.content.Context; 9 | import android.util.AttributeSet; 10 | 11 | import androidx.preference.ListPreference; 12 | import androidx.preference.PreferenceDataStore; 13 | import androidx.preference.PreferenceViewHolder; 14 | 15 | /** 16 | * A Preference which can automatically remove itself from the hierarchy 17 | * based on constraints set in XML. 18 | */ 19 | public abstract class SelfRemovingListPreference extends ListPreference { 20 | 21 | private final ConstraintsHelper mConstraints; 22 | 23 | public SelfRemovingListPreference(Context context, AttributeSet attrs, int defStyle) { 24 | super(context, attrs, defStyle); 25 | mConstraints = new ConstraintsHelper(context, attrs, this); 26 | setPreferenceDataStore(new DataStore()); 27 | } 28 | 29 | public SelfRemovingListPreference(Context context, AttributeSet attrs) { 30 | super(context, attrs); 31 | mConstraints = new ConstraintsHelper(context, attrs, this); 32 | setPreferenceDataStore(new DataStore()); 33 | } 34 | 35 | public SelfRemovingListPreference(Context context) { 36 | super(context); 37 | mConstraints = new ConstraintsHelper(context, null, this); 38 | setPreferenceDataStore(new DataStore()); 39 | } 40 | 41 | @Override 42 | public void onAttached() { 43 | super.onAttached(); 44 | mConstraints.onAttached(); 45 | } 46 | 47 | @Override 48 | public void onBindViewHolder(PreferenceViewHolder holder) { 49 | super.onBindViewHolder(holder); 50 | mConstraints.onBindViewHolder(holder); 51 | } 52 | 53 | public void setAvailable(boolean available) { 54 | mConstraints.setAvailable(available); 55 | } 56 | 57 | public boolean isAvailable() { 58 | return mConstraints.isAvailable(); 59 | } 60 | 61 | protected abstract boolean isPersisted(); 62 | protected abstract void putString(String key, String value); 63 | protected abstract String getString(String key, String defaultValue); 64 | 65 | @Override 66 | protected void onSetInitialValue(boolean restorePersistedValue, Object defaultValue) { 67 | final String value; 68 | if (!restorePersistedValue || !isPersisted()) { 69 | if (defaultValue == null) { 70 | return; 71 | } 72 | value = (String) defaultValue; 73 | if (shouldPersist()) { 74 | persistString(value); 75 | } 76 | } else { 77 | // Note: the default is not used because to have got here 78 | // isPersisted() must be true. 79 | value = getString(getKey(), null /* not used */); 80 | } 81 | setValue(value); 82 | } 83 | 84 | private class DataStore extends PreferenceDataStore { 85 | @Override 86 | public void putString(String key, String value) { 87 | SelfRemovingListPreference.this.putString(key, value); 88 | } 89 | 90 | @Override 91 | public String getString(String key, String defaultValue) { 92 | return SelfRemovingListPreference.this.getString(key, defaultValue); 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /packages/LineagePreferenceLib/java/lineageos/preference/SelfRemovingPreference.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2016 The CyanogenMod project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | package lineageos.preference; 6 | 7 | import android.content.Context; 8 | import android.util.AttributeSet; 9 | 10 | import androidx.preference.Preference; 11 | import androidx.preference.PreferenceViewHolder; 12 | 13 | /** 14 | * A Preference which can automatically remove itself from the hierarchy 15 | * based on constraints set in XML. 16 | */ 17 | public class SelfRemovingPreference extends Preference { 18 | 19 | private final ConstraintsHelper mConstraints; 20 | 21 | public SelfRemovingPreference(Context context, AttributeSet attrs, 22 | int defStyle, int defStyleRes) { 23 | super(context, attrs, defStyle, defStyleRes); 24 | mConstraints = new ConstraintsHelper(context, attrs, this); 25 | } 26 | 27 | public SelfRemovingPreference(Context context, AttributeSet attrs, int defStyle) { 28 | this(context, attrs, defStyle, 0); 29 | } 30 | 31 | public SelfRemovingPreference(Context context, AttributeSet attrs) { 32 | this(context, attrs, ConstraintsHelper.getAttr(context, 33 | androidx.preference.R.attr.preferenceStyle, 34 | android.R.attr.preferenceStyle)); 35 | } 36 | 37 | public SelfRemovingPreference(Context context) { 38 | this(context, null); 39 | } 40 | 41 | @Override 42 | public void onAttached() { 43 | super.onAttached(); 44 | mConstraints.onAttached(); 45 | } 46 | 47 | @Override 48 | public void onBindViewHolder(PreferenceViewHolder holder) { 49 | super.onBindViewHolder(holder); 50 | mConstraints.onBindViewHolder(holder); 51 | } 52 | 53 | public void setAvailable(boolean available) { 54 | mConstraints.setAvailable(available); 55 | } 56 | 57 | public boolean isAvailable() { 58 | return mConstraints.isAvailable(); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /packages/LineagePreferenceLib/java/lineageos/preference/SelfRemovingSwitchPreference.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2016 The CyanogenMod Project 3 | * SPDX-FileCopyrightText: 2018-2024 The LineageOS Project 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | package lineageos.preference; 7 | 8 | import android.content.Context; 9 | import android.util.AttributeSet; 10 | 11 | import androidx.preference.PreferenceDataStore; 12 | import androidx.preference.PreferenceViewHolder; 13 | import androidx.preference.SwitchPreferenceCompat; 14 | 15 | /** 16 | * A SwitchPreferenceCompat which can automatically remove itself from the hierarchy 17 | * based on constraints set in XML. 18 | */ 19 | public abstract class SelfRemovingSwitchPreference extends SwitchPreferenceCompat { 20 | 21 | private final ConstraintsHelper mConstraints; 22 | 23 | public SelfRemovingSwitchPreference(Context context, AttributeSet attrs, int defStyle) { 24 | super(context, attrs, defStyle); 25 | mConstraints = new ConstraintsHelper(context, attrs, this); 26 | setPreferenceDataStore(new DataStore()); 27 | } 28 | 29 | public SelfRemovingSwitchPreference(Context context, AttributeSet attrs) { 30 | super(context, attrs); 31 | mConstraints = new ConstraintsHelper(context, attrs, this); 32 | setPreferenceDataStore(new DataStore()); 33 | } 34 | 35 | public SelfRemovingSwitchPreference(Context context) { 36 | super(context); 37 | mConstraints = new ConstraintsHelper(context, null, this); 38 | setPreferenceDataStore(new DataStore()); 39 | } 40 | 41 | @Override 42 | public void onAttached() { 43 | super.onAttached(); 44 | mConstraints.onAttached(); 45 | } 46 | 47 | @Override 48 | public void onBindViewHolder(PreferenceViewHolder holder) { 49 | super.onBindViewHolder(holder); 50 | mConstraints.onBindViewHolder(holder); 51 | } 52 | 53 | public void setAvailable(boolean available) { 54 | mConstraints.setAvailable(available); 55 | } 56 | 57 | public boolean isAvailable() { 58 | return mConstraints.isAvailable(); 59 | } 60 | 61 | protected abstract boolean isPersisted(); 62 | protected abstract void putBoolean(String key, boolean value); 63 | protected abstract boolean getBoolean(String key, boolean defaultValue); 64 | 65 | @Override 66 | protected void onSetInitialValue(boolean restorePersistedValue, Object defaultValue) { 67 | final boolean checked; 68 | if (!restorePersistedValue || !isPersisted()) { 69 | if (defaultValue == null) { 70 | return; 71 | } 72 | checked = (boolean) defaultValue; 73 | if (shouldPersist()) { 74 | persistBoolean(checked); 75 | } 76 | } else { 77 | // Note: the default is not used because to have got here 78 | // isPersisted() must be true. 79 | checked = getBoolean(getKey(), false /* not used */); 80 | } 81 | setChecked(checked); 82 | } 83 | 84 | private class DataStore extends PreferenceDataStore { 85 | @Override 86 | public void putBoolean(String key, boolean value) { 87 | SelfRemovingSwitchPreference.this.putBoolean(key, value); 88 | } 89 | 90 | @Override 91 | public boolean getBoolean(String key, boolean defaultValue) { 92 | return SelfRemovingSwitchPreference.this.getBoolean(key, defaultValue); 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /packages/LineagePreferenceLib/java/lineageos/preference/SystemSettingMainSwitchPreference.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2021 The LineageOS Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package lineageos.preference; 7 | 8 | import android.content.Context; 9 | import android.provider.Settings; 10 | import android.util.AttributeSet; 11 | 12 | import androidx.preference.PreferenceDataStore; 13 | 14 | import com.android.settingslib.widget.MainSwitchPreference; 15 | 16 | public class SystemSettingMainSwitchPreference extends MainSwitchPreference { 17 | 18 | public SystemSettingMainSwitchPreference(Context context, AttributeSet attrs, int defStyle) { 19 | super(context, attrs, defStyle); 20 | setPreferenceDataStore(new DataStore()); 21 | } 22 | 23 | public SystemSettingMainSwitchPreference(Context context, AttributeSet attrs) { 24 | super(context, attrs); 25 | setPreferenceDataStore(new DataStore()); 26 | } 27 | 28 | public SystemSettingMainSwitchPreference(Context context) { 29 | super(context, null); 30 | setPreferenceDataStore(new DataStore()); 31 | } 32 | 33 | private class DataStore extends PreferenceDataStore { 34 | @Override 35 | public void putBoolean(String key, boolean value) { 36 | Settings.System.putInt(getContext().getContentResolver(), key, value ? 1 : 0); 37 | } 38 | 39 | @Override 40 | public boolean getBoolean(String key, boolean defaultValue) { 41 | return Settings.System.getInt(getContext().getContentResolver(), key, 42 | defaultValue ? 1 : 0) != 0; 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /packages/LineagePreferenceLib/java/lineageos/preference/SystemSettingSwitchPreference.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2013 The CyanogenMod Project 3 | * SPDX-FileCopyrightText: 2018 The LineageOS Project 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package lineageos.preference; 8 | 9 | import android.content.Context; 10 | import android.provider.Settings; 11 | import android.util.AttributeSet; 12 | 13 | public class SystemSettingSwitchPreference extends SelfRemovingSwitchPreference { 14 | 15 | public SystemSettingSwitchPreference(Context context, AttributeSet attrs, int defStyle) { 16 | super(context, attrs, defStyle); 17 | } 18 | 19 | public SystemSettingSwitchPreference(Context context, AttributeSet attrs) { 20 | super(context, attrs); 21 | } 22 | 23 | public SystemSettingSwitchPreference(Context context) { 24 | super(context, null); 25 | } 26 | 27 | @Override 28 | protected boolean isPersisted() { 29 | return Settings.System.getString(getContext().getContentResolver(), getKey()) != null; 30 | } 31 | 32 | @Override 33 | protected void putBoolean(String key, boolean value) { 34 | Settings.System.putInt(getContext().getContentResolver(), key, value ? 1 : 0); 35 | } 36 | 37 | @Override 38 | protected boolean getBoolean(String key, boolean defaultValue) { 39 | return Settings.System.getInt(getContext().getContentResolver(), 40 | key, defaultValue ? 1 : 0) != 0; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /packages/LineagePreferenceLib/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /packages/LineagePreferenceLib/res/values/public.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /packages/LineagePreferenceLib/res/values/symbols.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // SPDX-FileCopyrightText: 2018-2020 The LineageOS Project 3 | // SPDX-License-Identifier: Apache-2.0 4 | // 5 | 6 | android_app { 7 | name: "LineageSettingsProvider", 8 | srcs: ["src/**/*.java"], 9 | resource_dirs: ["res"], 10 | 11 | certificate: "platform", 12 | privileged: true, 13 | platform_apis: true, 14 | system_ext_specific: true, 15 | 16 | static_libs: [ 17 | "org.lineageos.platform.internal", 18 | ], 19 | 20 | required: [ 21 | "privapp_whitelist_org.lineageos.lineagesettings", 22 | ], 23 | } 24 | 25 | prebuilt_etc { 26 | name: "privapp_whitelist_org.lineageos.lineagesettings", 27 | sub_dir: "permissions", 28 | src: "privapp_whitelist_org.lineageos.lineagesettings.xml", 29 | filename_from_src: true, 30 | system_ext_specific: true, 31 | } 32 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 10 | 14 | 15 | 16 | 17 | 18 | 19 | 27 | 28 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/privapp_whitelist_org.lineageos.lineagesettings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 11 | 14 | 15 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/drawable/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 12 | 13 | 15 | 19 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/mipmap-anydpi/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-ar/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | اعدادت تخزين Lineage 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-ast-rES/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Almacenamientu d\'axustes de Lineage 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-az/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Lineage Ayarlar Anbarı 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-be/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Сховішча налад LineageOS 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-bg/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Настройки на хранилището на Lineage 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-ca/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Configuració d\'emmagatzematge de Lineage 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-cs/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Úložiště nastavení systému Lineage 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-cy/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Storfa Gosodiadau Lineage 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-da/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Lineage Indstillingslager 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-de/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Lineage-Einstellungsspeicher 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-el/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Αποθηκευτικός χώρος ρυθμίσεων Lineage 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-en-rAU/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Lineage Settings Storage 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-en-rCA/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Lineage Settings Storage 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-en-rGB/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Lineage Settings Storage 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-en-rIN/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Lineage Settings Storage 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-es-rUS/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Almacenamiento de los ajustes de Lineage 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-es/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Almacenamiento de los ajustes de Lineage 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-et/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Lineage seadete salvestusruum 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-eu/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Lineage ezarpenen biltegiratzea 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-fa/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | ذخیره تنظیمات Lineage 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-fi/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Lineage asetusten tallennustila 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-fr/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Stockage des paramètres de Lineage 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-fur-rIT/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Archivi impostazions di Lineage 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-fy-rNL/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Lineage-ynstellingenûnthâld 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-ga-rIE/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Stóráil Socruithe Lineage 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-gd/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Stòras roghainnean Lineage 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-gl/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Axustes de almacenamento 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-hr/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Lineage Postavke Pohrane 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-hu/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Lineage-Beállítástároló 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-in/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Setelan Penyimpanan Lineage 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-is/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Lineage gagnageymslustillingar 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-it/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Archivio impostazioni di Lineage 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-iw/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | הגדרות אחסון Lineage 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-ja/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | LineageOS 設定ストレージ 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-ka/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Lineage-პარამეტრების საცავი 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-kab-rDZ/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Aklas n yiɣewwaren n Lineage 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-kn/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Lineage ಅಳವಡಿಕೆಗಳ ದಾಸ್ತಾನು 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-ko/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Lineage 설정 저장소 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-nb/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Lineage Lagringsinnstillinger 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-nl/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Lineage instellingenopslag 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-pl/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Ustawienia Pamięci Lineage 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-pt-rBR/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Armazenamento de Configurações do Lineage 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-pt-rPT/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Definições de Armazenamento do Lineage 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-ro/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Setări de Stocare Lineage 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-ru/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Хранилище настроек LineageOS 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-sc-rIT/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Archìviu de impostatziones de Lineage 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-sk/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Nastavenia úložiska Lineage 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-sl/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Shramba nastavitev Lineage 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-sq/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Memoria e Parametrave të Lineage 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-sr/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Складиште Lineage поставки 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-sv/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Lagring för Lineage-inställningar 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-ta/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Lineage அமைவுகள் சேமிப்பகம் 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-th/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | การตั้งค่าพื้นที่เก็บข้อมูล Lineage 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-tr/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Lineage Ayarları Deposu 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-uk/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Сховище налаштувань LineageOS 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-vi/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Lưu Trữ Cài Đặt Lineage 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-zh-rCN/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Lineage 设置储存 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values-zh-rTW/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Lineage 設定儲存空間 8 | 9 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values/defaults.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | false 13 | 14 | 15 | false 16 | 17 | 18 | false 19 | 20 | 21 | true 22 | 23 | 24 | 25 | 26 | 0 27 | 28 | 32 | 0 33 | 34 | 35 | 255 36 | 37 | 39 | 255 40 | 41 | 43 | 255 44 | 45 | 48 | 255 49 | 50 | 51 | true 52 | 53 | 54 | false 55 | 56 | 57 | 58 | false 59 | 60 | 65 | 0 66 | 67 | 72 | 2 73 | 74 | 75 | -------------------------------------------------------------------------------- /packages/LineageSettingsProvider/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | Lineage Settings Storage 8 | 9 | -------------------------------------------------------------------------------- /sdk/src/java/lineageos/app/ILineageGlobalActions.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2021 The LineageOS Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package lineageos.app; 7 | 8 | /** @hide */ 9 | interface ILineageGlobalActions { 10 | 11 | void updateUserConfig(boolean enabled, String action); 12 | 13 | List getLocalUserConfig(); 14 | 15 | String[] getUserActionsArray(); 16 | 17 | boolean userConfigContains(String preference); 18 | } 19 | -------------------------------------------------------------------------------- /sdk/src/java/lineageos/app/IProfileManager.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2015 The CyanogenMod Project 3 | * SPDX-FileCopyrightText: 2025 LineageOS Project 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package lineageos.app; 8 | 9 | import android.os.ParcelUuid; 10 | 11 | import lineageos.app.NotificationGroup; 12 | import lineageos.app.Profile; 13 | 14 | /** {@hide} */ 15 | interface IProfileManager 16 | { 17 | boolean setActiveProfile(in ParcelUuid profileParcelUuid); 18 | boolean setActiveProfileByName(String profileName); 19 | Profile getActiveProfile(); 20 | 21 | boolean addProfile(in Profile profile); 22 | boolean removeProfile(in Profile profile); 23 | void updateProfile(in Profile profile); 24 | 25 | Profile getProfile(in ParcelUuid profileParcelUuid); 26 | Profile getProfileByName(String profileName); 27 | Profile[] getProfiles(); 28 | boolean profileExists(in ParcelUuid profileUuid); 29 | boolean profileExistsByName(String profileName); 30 | boolean notificationGroupExistsByName(String notificationGroupName); 31 | 32 | NotificationGroup[] getNotificationGroups(); 33 | void addNotificationGroup(in NotificationGroup group); 34 | void removeNotificationGroup(in NotificationGroup group); 35 | void updateNotificationGroup(in NotificationGroup group); 36 | NotificationGroup getNotificationGroupForPackage(in String pkg); 37 | NotificationGroup getNotificationGroup(in ParcelUuid groupParcelUuid); 38 | 39 | void resetAll(); 40 | boolean isEnabled(); 41 | } 42 | -------------------------------------------------------------------------------- /sdk/src/java/lineageos/app/NotificationGroup.aidl: -------------------------------------------------------------------------------- 1 | /** 2 | * SPDX-FileCopyrightText: 2012 The CyanogenMod Project 3 | * SPDX-FileCopyrightText: 2025 The LineageOS Project 4 | */ 5 | 6 | package lineageos.app; 7 | 8 | parcelable NotificationGroup; 9 | -------------------------------------------------------------------------------- /sdk/src/java/lineageos/app/Profile.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2015 The CyanogenMod Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package lineageos.app; 7 | 8 | parcelable Profile; 9 | -------------------------------------------------------------------------------- /sdk/src/java/lineageos/content/Intent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2015 The CyanogenMod Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package lineageos.content; 7 | 8 | import android.Manifest; 9 | 10 | /** 11 | * LineageOS specific intent definition class. 12 | */ 13 | public class Intent { 14 | 15 | /** 16 | * Activity Action: Start action associated with long press on the recents key. 17 | *

Input: {@link #EXTRA_LONG_PRESS_RELEASE} is set to true if the long press 18 | * is released 19 | *

Output: Nothing 20 | */ 21 | public static final String ACTION_RECENTS_LONG_PRESS = 22 | "lineageos.intent.action.RECENTS_LONG_PRESS"; 23 | 24 | /** 25 | * This field is part of the intent {@link #ACTION_RECENTS_LONG_PRESS}. 26 | * The type of the extra is a boolean that indicates if the long press 27 | * is released. 28 | */ 29 | public static final String EXTRA_RECENTS_LONG_PRESS_RELEASE = 30 | "lineageos.intent.extra.RECENTS_LONG_PRESS_RELEASE"; 31 | 32 | /** 33 | * Broadcast action: notify the system that the user has performed a gesture on the screen 34 | * to launch the camera. Broadcast should be protected to receivers holding the 35 | * {@link Manifest.permission#STATUS_BAR_SERVICE} permission. 36 | */ 37 | public static final String ACTION_SCREEN_CAMERA_GESTURE = 38 | "lineageos.intent.action.SCREEN_CAMERA_GESTURE"; 39 | 40 | /** 41 | * Broadcast action: perform any initialization required for LineageHW services. 42 | * Runs when the service receives the signal the device has booted, but 43 | * should happen before {@link android.content.Intent#ACTION_BOOT_COMPLETED}. 44 | * 45 | * Requires {@link lineageos.platform.Manifest.permission#HARDWARE_ABSTRACTION_ACCESS}. 46 | */ 47 | public static final String ACTION_INITIALIZE_LINEAGE_HARDWARE = 48 | "lineageos.intent.action.INITIALIZE_LINEAGE_HARDWARE"; 49 | 50 | /** 51 | * Broadcast action: lid state changed 52 | */ 53 | public static final String ACTION_LID_STATE_CHANGED = 54 | "lineageos.intent.action.LID_STATE_CHANGED"; 55 | 56 | /** 57 | * This field is part of the intent {@link #ACTION_LID_STATE_CHANGED}. 58 | * Intent extra field for the state of lid/cover 59 | */ 60 | public static final String EXTRA_LID_STATE = 61 | "lineageos.intent.extra.LID_STATE"; 62 | 63 | /** 64 | * Broadcast action: notify SystemUI that LiveDisplay service has finished initialization. 65 | */ 66 | public static final String ACTION_INITIALIZE_LIVEDISPLAY = 67 | "lineageos.intent.action.INITIALIZE_LIVEDISPLAY"; 68 | } 69 | -------------------------------------------------------------------------------- /sdk/src/java/lineageos/hardware/DisplayMode.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2015 The CyanogenMod Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package lineageos.hardware; 7 | 8 | parcelable DisplayMode; 9 | -------------------------------------------------------------------------------- /sdk/src/java/lineageos/hardware/DisplayMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2015 The CyanogenMod Project 3 | * SPDX-FileCopyrightText: 2025 The LineageOS Project 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package lineageos.hardware; 8 | 9 | import android.os.Parcel; 10 | import android.os.Parcelable; 11 | 12 | /** 13 | * Display Modes API 14 | * 15 | * A device may implement a list of preset display modes for different 16 | * viewing intents, such as movies, photos, or extra vibrance. These 17 | * modes may have multiple components such as gamma correction, white 18 | * point adjustment, etc, but are activated by a single control point. 19 | * 20 | * This API provides support for enumerating and selecting the 21 | * modes supported by the hardware. 22 | * 23 | * A DisplayMode is referenced by it's identifier and carries an 24 | * associated name (up to the user to translate this value). 25 | */ 26 | public class DisplayMode implements Parcelable { 27 | public final int id; 28 | public final String name; 29 | 30 | public DisplayMode(int id, String name) { 31 | this.id = id; 32 | this.name = name; 33 | } 34 | 35 | private DisplayMode(Parcel parcel) { 36 | this.id = parcel.readInt(); 37 | this.name = parcel.readInt() != 0 ? parcel.readString() : null; 38 | } 39 | 40 | @Override 41 | public int describeContents() { 42 | return 0; 43 | } 44 | 45 | @Override 46 | public void writeToParcel(Parcel out, int flags) { 47 | out.writeInt(id); 48 | if (name != null) { 49 | out.writeInt(1); 50 | out.writeString(name); 51 | } else { 52 | out.writeInt(0); 53 | } 54 | } 55 | 56 | /** @hide */ 57 | public static final Parcelable.Creator CREATOR = 58 | new Parcelable.Creator() { 59 | public DisplayMode createFromParcel(Parcel in) { 60 | return new DisplayMode(in); 61 | } 62 | 63 | @Override 64 | public DisplayMode[] newArray(int size) { 65 | return new DisplayMode[size]; 66 | } 67 | }; 68 | 69 | } 70 | -------------------------------------------------------------------------------- /sdk/src/java/lineageos/hardware/HIDLHelper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2019 The LineageOS Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package lineageos.hardware; 7 | 8 | import android.util.Range; 9 | 10 | import java.util.ArrayList; 11 | 12 | class HIDLHelper { 13 | 14 | static DisplayMode[] fromHIDLModes( 15 | ArrayList modes) { 16 | int size = modes.size(); 17 | DisplayMode[] r = new DisplayMode[size]; 18 | for (int i = 0; i < size; i++) { 19 | vendor.lineage.livedisplay.V2_0.DisplayMode m = modes.get(i); 20 | r[i] = new DisplayMode(m.id, m.name); 21 | } 22 | return r; 23 | } 24 | 25 | static DisplayMode fromHIDLMode( 26 | vendor.lineage.livedisplay.V2_0.DisplayMode mode) { 27 | return new DisplayMode(mode.id, mode.name); 28 | } 29 | 30 | static HSIC fromHIDLHSIC(vendor.lineage.livedisplay.V2_0.HSIC hsic) { 31 | return new HSIC(hsic.hue, hsic.saturation, hsic.intensity, 32 | hsic.contrast, hsic.saturationThreshold); 33 | } 34 | 35 | static vendor.lineage.livedisplay.V2_0.HSIC toHIDLHSIC(HSIC hsic) { 36 | vendor.lineage.livedisplay.V2_0.HSIC h = new vendor.lineage.livedisplay.V2_0.HSIC(); 37 | h.hue = hsic.getHue(); 38 | h.saturation = hsic.getSaturation(); 39 | h.intensity = hsic.getIntensity(); 40 | h.contrast = hsic.getContrast(); 41 | h.saturationThreshold = hsic.getSaturationThreshold(); 42 | return h; 43 | } 44 | 45 | static Range fromHIDLRange(vendor.lineage.livedisplay.V2_0.Range range) { 46 | return new Range(range.min, range.max); 47 | } 48 | 49 | static Range fromHIDLRange(vendor.lineage.livedisplay.V2_0.FloatRange range) { 50 | return new Range(range.min, range.max); 51 | } 52 | 53 | static TouchscreenGesture[] fromHIDLGestures( 54 | ArrayList gestures) { 55 | int size = gestures.size(); 56 | TouchscreenGesture[] r = new TouchscreenGesture[size]; 57 | for (int i = 0; i < size; i++) { 58 | vendor.lineage.touch.V1_0.Gesture g = gestures.get(i); 59 | r[i] = new TouchscreenGesture(g.id, g.name, g.keycode); 60 | } 61 | return r; 62 | } 63 | 64 | static vendor.lineage.touch.V1_0.Gesture toHIDLGesture(TouchscreenGesture gesture) { 65 | vendor.lineage.touch.V1_0.Gesture g = new vendor.lineage.touch.V1_0.Gesture(); 66 | g.id = gesture.id; 67 | g.name = gesture.name; 68 | g.keycode = gesture.keycode; 69 | return g; 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /sdk/src/java/lineageos/hardware/HSIC.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2015 The CyanogenMod Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package lineageos.hardware; 7 | 8 | parcelable HSIC; 9 | -------------------------------------------------------------------------------- /sdk/src/java/lineageos/hardware/ILineageHardwareService.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2015-2016 The CyanogenMod Project 3 | * SPDX-FileCopyrightText: 2017-2018 The LineageOS Project 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package lineageos.hardware; 8 | 9 | /** @hide */ 10 | interface ILineageHardwareService { 11 | 12 | int getSupportedFeatures(); 13 | boolean get(int feature); 14 | boolean set(int feature, boolean enable); 15 | 16 | int[] getDisplayColorCalibration(); 17 | boolean setDisplayColorCalibration(in int[] rgb); 18 | } 19 | -------------------------------------------------------------------------------- /sdk/src/java/lineageos/hardware/ILiveDisplayService.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2016, The CyanogenMod Project 3 | * SPDX-FileCopyrightText: 2021 The LineageOS Project 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package lineageos.hardware; 8 | 9 | import lineageos.hardware.HSIC; 10 | import lineageos.hardware.LiveDisplayConfig; 11 | 12 | /** @hide */ 13 | interface ILiveDisplayService { 14 | LiveDisplayConfig getConfig(); 15 | 16 | int getMode(); 17 | boolean setMode(int mode); 18 | 19 | float[] getColorAdjustment(); 20 | boolean setColorAdjustment(in float[] adj); 21 | 22 | boolean isAutoContrastEnabled(); 23 | boolean setAutoContrastEnabled(boolean enabled); 24 | 25 | boolean isCABCEnabled(); 26 | boolean setCABCEnabled(boolean enabled); 27 | 28 | boolean isColorEnhancementEnabled(); 29 | boolean setColorEnhancementEnabled(boolean enabled); 30 | 31 | int getDayColorTemperature(); 32 | boolean setDayColorTemperature(int temperature); 33 | 34 | int getNightColorTemperature(); 35 | boolean setNightColorTemperature(int temperature); 36 | 37 | int getColorTemperature(); 38 | 39 | boolean isAutomaticOutdoorModeEnabled(); 40 | boolean setAutomaticOutdoorModeEnabled(boolean enabled); 41 | 42 | HSIC getPictureAdjustment(); 43 | HSIC getDefaultPictureAdjustment(); 44 | boolean setPictureAdjustment(in HSIC adj); 45 | boolean isNight(); 46 | 47 | boolean isAntiFlickerEnabled(); 48 | boolean setAntiFlickerEnabled(boolean enabled); 49 | } 50 | -------------------------------------------------------------------------------- /sdk/src/java/lineageos/hardware/LiveDisplayConfig.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2016 The CyanogenMod Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package lineageos.hardware; 7 | 8 | parcelable LiveDisplayConfig; 9 | -------------------------------------------------------------------------------- /sdk/src/java/lineageos/hardware/TouchscreenGesture.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2016 The CyanogenMod Project 3 | * SPDX-FileCopyrightText: 2017 The LineageOS Project 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package lineageos.hardware; 8 | 9 | parcelable TouchscreenGesture; 10 | -------------------------------------------------------------------------------- /sdk/src/java/lineageos/hardware/TouchscreenGesture.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2016 The CyanogenMod Project 3 | * SPDX-FileCopyrightText: 2017 The LineageOS Project 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package lineageos.hardware; 8 | 9 | import android.os.Parcel; 10 | import android.os.Parcelable; 11 | 12 | /** 13 | * Touchscreen gestures API 14 | * 15 | * A device may implement several touchscreen gestures for use while 16 | * the display is turned off, such as drawing alphabets and shapes. 17 | * These gestures can be interpreted by userspace to activate certain 18 | * actions and launch certain apps, such as to skip music tracks, 19 | * to turn on the flashlight, or to launch the camera app. 20 | * 21 | * This *should always* be supported by the hardware directly. 22 | * A lot of recent touch controllers have a firmware option for this. 23 | * 24 | * This API provides support for enumerating the gestures 25 | * supported by the touchscreen. 26 | * 27 | * A TouchscreenGesture is referenced by it's identifier and carries an 28 | * associated name (up to the user to translate this value). 29 | */ 30 | public class TouchscreenGesture implements Parcelable { 31 | 32 | public final int id; 33 | public final String name; 34 | public final int keycode; 35 | 36 | public TouchscreenGesture(int id, String name, int keycode) { 37 | this.id = id; 38 | this.name = name; 39 | this.keycode = keycode; 40 | } 41 | 42 | @Override 43 | public int describeContents() { 44 | return 0; 45 | } 46 | 47 | @Override 48 | public void writeToParcel(Parcel parcel, int flags) { 49 | parcel.writeInt(id); 50 | parcel.writeString(name); 51 | parcel.writeInt(keycode); 52 | } 53 | 54 | /** @hide */ 55 | public static final Parcelable.Creator CREATOR = 56 | new Parcelable.Creator() { 57 | 58 | public TouchscreenGesture createFromParcel(Parcel in) { 59 | return new TouchscreenGesture(in.readInt(), in.readString(), in.readInt()); 60 | } 61 | 62 | @Override 63 | public TouchscreenGesture[] newArray(int size) { 64 | return new TouchscreenGesture[size]; 65 | } 66 | }; 67 | } 68 | -------------------------------------------------------------------------------- /sdk/src/java/lineageos/health/IHealthInterface.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2023 The LineageOS Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package lineageos.health; 7 | 8 | /** @hide */ 9 | interface IHealthInterface { 10 | boolean isChargingControlSupported(); 11 | 12 | boolean getChargingControlEnabled(); 13 | boolean setChargingControlEnabled(boolean enabled); 14 | 15 | int getChargingControlMode(); 16 | boolean setChargingControlMode(int mode); 17 | 18 | int getChargingControlStartTime(); 19 | boolean setChargingControlStartTime(int time); 20 | 21 | int getChargingControlTargetTime(); 22 | boolean setChargingControlTargetTime(int time); 23 | 24 | int getChargingControlLimit(); 25 | boolean setChargingControlLimit(int limit); 26 | 27 | boolean resetChargingControl(); 28 | boolean allowFineGrainedSettings(); 29 | } 30 | -------------------------------------------------------------------------------- /sdk/src/java/lineageos/trust/ITrustInterface.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2018-2019 The LineageOS Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package lineageos.trust; 7 | 8 | /** {@hide} */ 9 | interface ITrustInterface { 10 | 11 | boolean postNotificationForFeature(int feature); 12 | boolean removeNotificationForFeature(int feature); 13 | boolean hasUsbRestrictor(); 14 | int getLevelForFeature(int feature); 15 | void runTest(); 16 | } 17 | -------------------------------------------------------------------------------- /sdk/src/java/org/lineageos/internal/applications/LineageActivityManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2018 The LineageOS project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.lineageos.internal.applications; 7 | 8 | import android.content.Context; 9 | 10 | public class LineageActivityManager { 11 | private Context mContext; 12 | 13 | // Long screen related activity settings 14 | private LongScreen mLongScreen; 15 | 16 | public LineageActivityManager(Context context) { 17 | mContext = context; 18 | 19 | mLongScreen = new LongScreen(context); 20 | } 21 | 22 | public boolean shouldForceLongScreen(String packageName) { 23 | return mLongScreen.shouldForceLongScreen(packageName); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /sdk/src/java/org/lineageos/internal/applications/LongScreen.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2018 The LineageOS project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.lineageos.internal.applications; 7 | 8 | import android.content.ContentResolver; 9 | import android.content.Context; 10 | import android.content.res.Resources; 11 | import android.database.ContentObserver; 12 | import android.os.Handler; 13 | import android.os.Looper; 14 | import android.os.UserHandle; 15 | 16 | import lineageos.providers.LineageSettings; 17 | 18 | import java.util.Arrays; 19 | import java.util.HashSet; 20 | import java.util.Set; 21 | 22 | public class LongScreen { 23 | private Set mApps = new HashSet<>(); 24 | private Context mContext; 25 | 26 | private final boolean mLongScreenAvailable; 27 | 28 | public LongScreen(Context context) { 29 | mContext = context; 30 | final Resources resources = mContext.getResources(); 31 | 32 | mLongScreenAvailable = resources.getBoolean( 33 | org.lineageos.platform.internal.R.bool.config_haveHigherAspectRatioScreen); 34 | 35 | if (!mLongScreenAvailable) { 36 | return; 37 | } 38 | 39 | SettingsObserver observer = new SettingsObserver( 40 | new Handler(Looper.getMainLooper())); 41 | observer.observe(); 42 | } 43 | 44 | public boolean isSupported() { 45 | return mLongScreenAvailable; 46 | } 47 | 48 | public boolean shouldForceLongScreen(String packageName) { 49 | return isSupported() && mApps.contains(packageName); 50 | } 51 | 52 | public Set getApps() { 53 | return mApps; 54 | } 55 | 56 | public void addApp(String packageName) { 57 | mApps.add(packageName); 58 | LineageSettings.System.putString(mContext.getContentResolver(), 59 | LineageSettings.System.LONG_SCREEN_APPS, String.join(",", mApps)); 60 | } 61 | 62 | public void removeApp(String packageName) { 63 | mApps.remove(packageName); 64 | LineageSettings.System.putString(mContext.getContentResolver(), 65 | LineageSettings.System.LONG_SCREEN_APPS, String.join(",", mApps)); 66 | } 67 | 68 | public void setApps(Set apps) { 69 | mApps = apps; 70 | } 71 | 72 | class SettingsObserver extends ContentObserver { 73 | SettingsObserver(Handler handler) { 74 | super(handler); 75 | } 76 | 77 | void observe() { 78 | ContentResolver resolver = mContext.getContentResolver(); 79 | 80 | resolver.registerContentObserver(LineageSettings.System.getUriFor( 81 | LineageSettings.System.LONG_SCREEN_APPS), false, this, 82 | UserHandle.USER_ALL); 83 | 84 | update(); 85 | } 86 | 87 | @Override 88 | public void onChange(boolean selfChange) { 89 | update(); 90 | } 91 | 92 | public void update() { 93 | ContentResolver resolver = mContext.getContentResolver(); 94 | 95 | String apps = LineageSettings.System.getStringForUser(resolver, 96 | LineageSettings.System.LONG_SCREEN_APPS, 97 | UserHandle.USER_CURRENT); 98 | if (apps != null) { 99 | setApps(new HashSet<>(Arrays.asList(apps.split(",")))); 100 | } else { 101 | setApps(new HashSet<>()); 102 | } 103 | } 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /sdk/src/java/org/lineageos/internal/graphics/drawable/StopMotionVectorDrawable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2016 The CyanogenMod Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.lineageos.internal.graphics.drawable; 7 | 8 | import android.animation.Animator; 9 | import android.animation.AnimatorSet; 10 | import android.animation.ValueAnimator; 11 | import android.graphics.drawable.AnimatedVectorDrawable; 12 | import android.graphics.drawable.Drawable; 13 | import android.graphics.drawable.DrawableWrapper; 14 | import android.util.Log; 15 | 16 | import java.lang.reflect.Field; 17 | import java.util.ArrayList; 18 | 19 | /** 20 | * Wraps an {@link AnimatedVectorDrawable} and provides methods for setting the temporal position 21 | * within the backing {@link AnimatorSet} of the wrapped {@link AnimatedVectorDrawable}. 22 | */ 23 | public class StopMotionVectorDrawable extends DrawableWrapper { 24 | private static final String TAG = StopMotionVectorDrawable.class.getSimpleName(); 25 | 26 | private AnimatedVectorDrawable mDrawable; 27 | private AnimatorSet mAnimatorSet; 28 | 29 | /** 30 | * Creates a new wrapper around the specified drawable. 31 | * 32 | * @param dr The drawable to wrap. Must be an {@link AnimatedVectorDrawable} 33 | */ 34 | public StopMotionVectorDrawable(Drawable dr) { 35 | super(dr); 36 | setDrawable(dr); 37 | } 38 | 39 | /** 40 | * {@see DrawableWrapper$setDrawable} 41 | * @param dr the wrapped drawable 42 | * @throws IllegalArgumentException IF drawable is not an {@link AnimatedVectorDrawable} 43 | */ 44 | @Override 45 | public void setDrawable(Drawable dr) { 46 | if (dr != null && !(dr instanceof AnimatedVectorDrawable)) { 47 | throw new IllegalArgumentException("Drawable must be an AnimatedVectorDrawable"); 48 | } 49 | 50 | super.setDrawable(dr); 51 | mDrawable = (AnimatedVectorDrawable) dr; 52 | if (mDrawable != null) { 53 | mDrawable.reset(); 54 | getAnimatorSetViaReflection(); 55 | } 56 | } 57 | 58 | /** 59 | * {@see android.animation.ValueAnimator#setCurrentFraction} 60 | * @param fraction The fraction to which the animation is advanced or rewound. Values outside 61 | * the range of 0 to the maximum fraction for the animator will be clamped to 62 | * the correct range. 63 | */ 64 | public void setCurrentFraction(float fraction) { 65 | if (mDrawable == null || mAnimatorSet == null) return; 66 | 67 | ArrayList animators = mAnimatorSet.getChildAnimations(); 68 | for (Animator animator : animators) { 69 | if (animator instanceof ValueAnimator) { 70 | ((ValueAnimator) animator).setCurrentFraction(fraction); 71 | } 72 | } 73 | 74 | mDrawable.invalidateSelf(); 75 | } 76 | 77 | private void getAnimatorSetViaReflection() { 78 | try { 79 | Field _mAnimatorSet = AnimatedVectorDrawable.class.getDeclaredField("mAnimatorSet"); 80 | _mAnimatorSet.setAccessible(true); 81 | Class innerClazz = Class.forName("android.graphics.drawable.AnimatedVectorDrawable$VectorDrawableAnimatorUI"); 82 | mDrawable.forceAnimationOnUI(); 83 | Object _inner = _mAnimatorSet.get(mDrawable); 84 | Field _mSet = innerClazz.getDeclaredField("mSet"); 85 | _mSet.setAccessible(true); 86 | mAnimatorSet = (AnimatorSet) _mSet.get(_inner); 87 | } catch (NoSuchFieldException | IllegalAccessException | ClassNotFoundException e) { 88 | Log.e(TAG, "Could not get mAnimatorSet via reflection", e); 89 | } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /sdk/src/java/org/lineageos/internal/logging/LineageMetricsLogger.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2016 The CyanogenMod Project 3 | * SPDX-FileCopyrightText: 2018-2021 The LineageOS Project 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package org.lineageos.internal.logging; 8 | 9 | import com.android.internal.logging.MetricsLogger; 10 | 11 | /** 12 | * Serves as a central location for logging constants that is android release agnostic. 13 | */ 14 | public class LineageMetricsLogger extends MetricsLogger { 15 | private static final int BASE = -Integer.MAX_VALUE; 16 | //Since we never want to collide, lets start at the back and move inward 17 | public static final int DONT_LOG = BASE + 1; 18 | 19 | public static final int ANONYMOUS_STATS = BASE + 2; 20 | public static final int APP_GROUP_CONFIG = BASE + 3; 21 | public static final int APP_GROUP_LIST = BASE + 4; 22 | public static final int BATTERY_LIGHT_SETTINGS = BASE + 5; 23 | public static final int BUTTON_SETTINGS = BASE + 6; 24 | public static final int CHOOSE_LOCK_PATTERN_SIZE = BASE + 7; 25 | public static final int DISPLAY_ROTATION = BASE + 8; 26 | public static final int LIVE_DISPLAY = BASE + 9; 27 | public static final int NOTIFICATION_LIGHT_SETTINGS = BASE + 10; 28 | public static final int NOTIFICATION_MANAGER_SETTINGS = BASE + 11; 29 | public static final int POWER_MENU_ACTIONS = BASE + 12; 30 | public static final int PREVIEW_DATA = BASE + 13; 31 | public static final int PRIVACY_GUARD_PREFS = BASE + 14; 32 | public static final int PRIVACY_SETTINGS = BASE + 15; 33 | public static final int PROFILE_GROUP_CONFIG = BASE + 16; 34 | public static final int PROFILES_SETTINGS = BASE + 17; 35 | public static final int SETUP_ACTIONS_FRAGMENT = BASE + 18; 36 | public static final int SETUP_TRIGGERS_FRAGMENT = BASE + 19; 37 | public static final int STYLUS_GESTURES = BASE + 20; 38 | public static final int TILE_ADB_OVER_NETWORK = BASE + 21; 39 | public static final int TILE_AMBIENT_DISPLAY = BASE + 22; 40 | public static final int TILE_COMPASS = BASE + 23; 41 | public static final int TILE_CUSTOM_QS = BASE + 24; 42 | public static final int TILE_CUSTOM_QS_DETAIL = BASE + 25; 43 | public static final int TILE_EDIT = BASE + 26; 44 | public static final int TILE_LIVE_DISPLAY = BASE + 27; 45 | public static final int TILE_LOCKSCREEN_TOGGLE = BASE + 28; 46 | public static final int TILE_NFC = BASE + 29; 47 | public static final int TILE_PERF_PROFILE = BASE + 30; 48 | public static final int TILE_PERF_PROFILE_DETAIL = BASE + 31; 49 | public static final int TILE_PROFILES = BASE + 32; 50 | public static final int TILE_PROFILES_DETAIL = BASE + 33; 51 | public static final int TILE_SCREEN_TIME_OUT = BASE + 34; 52 | public static final int TILE_SCREEN_TIME_OUT_DETAIL = BASE + 35; 53 | public static final int TILE_SYNC = BASE + 36; 54 | public static final int TILE_USB_TETHER = BASE + 37; 55 | public static final int TILE_VOLUME = BASE + 38; 56 | public static final int TILE_HEADS_UP = BASE + 39; 57 | public static final int TILE_BATTERY_SAVER = BASE + 40; 58 | public static final int TILE_CAFFEINE = BASE + 41; 59 | public static final int TILE_THEMES = BASE + 43; 60 | public static final int TILE_LOCATION_DETAIL = BASE + 44; 61 | public static final int TILE_READING_MODE = BASE + 45; 62 | public static final int TILE_AOD = BASE + 46; 63 | public static final int TILE_POWERSHARE = BASE + 47; 64 | public static final int TILE_ANTI_FLICKER = BASE + 48; 65 | public static final int SYSTEM_BUTTON_SETTINGS = BASE + 49; 66 | } 67 | -------------------------------------------------------------------------------- /sdk/src/java/org/lineageos/internal/notification/LedValues.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2017 The LineageOS Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.lineageos.internal.notification; 7 | 8 | public class LedValues { 9 | public static final int LIGHT_BRIGHTNESS_MAXIMUM = 255; 10 | 11 | private boolean mEnabled; 12 | private int mColor; 13 | private int mOnMs; 14 | private int mOffMs; 15 | private int mBrightness; 16 | 17 | public LedValues(int color, int onMs, int offMs) { 18 | this(color, onMs, offMs, LIGHT_BRIGHTNESS_MAXIMUM); 19 | } 20 | 21 | public LedValues(int color, int onMs, int offMs, int brightness) { 22 | this(true, color, onMs, offMs, brightness); 23 | } 24 | 25 | public LedValues(boolean enabled, int color, int onMs, int offMs, int brightness) { 26 | mEnabled = enabled; 27 | mColor = color; 28 | mOnMs = onMs; 29 | mOffMs = offMs; 30 | mBrightness = brightness; 31 | } 32 | 33 | public boolean isEnabled() { 34 | return mEnabled; 35 | } 36 | 37 | public void setEnabled(boolean enable) { 38 | mEnabled = enable; 39 | } 40 | 41 | public int getColor() { 42 | return mColor; 43 | } 44 | 45 | public void setColor(int color) { 46 | mColor = color; 47 | } 48 | 49 | public int getOnMs() { 50 | return mOnMs; 51 | } 52 | 53 | public void setOnMs(int onMs) { 54 | mOnMs = onMs; 55 | } 56 | 57 | public int getOffMs() { 58 | return mOffMs; 59 | } 60 | 61 | public void setOffMs(int offMs) { 62 | mOffMs = offMs; 63 | } 64 | 65 | public int getBrightness() { 66 | return mBrightness; 67 | } 68 | 69 | public void setBrightness(int brightness) { 70 | mBrightness = brightness; 71 | } 72 | 73 | public void setSolid() { 74 | mOnMs = 0; 75 | mOffMs = 0; 76 | } 77 | 78 | public boolean isPulsed() { 79 | return mOnMs != 0 && mOffMs != 0; 80 | } 81 | 82 | public void setPulsed(int onMs, int offMs) { 83 | mOnMs = onMs; 84 | mOffMs = offMs; 85 | } 86 | 87 | public void applyAlphaToBrightness() { 88 | final int alpha = (mColor >> 24) & 0xFF; 89 | if (alpha > 0 && alpha < 255) { 90 | mBrightness = mBrightness * alpha / 255; 91 | } 92 | mColor |= 0xFF000000; 93 | } 94 | 95 | public void applyBrightnessToColor() { 96 | if (mBrightness > 0 && mBrightness < 255) { 97 | int red = ((mColor >> 16) & 0xFF) * mBrightness / 255; 98 | int green = ((mColor >> 8) & 0xFF) * mBrightness / 255; 99 | int blue = (mColor & 0xFF) * mBrightness / 255; 100 | mColor = (red << 16) | (green << 8) | blue; 101 | mBrightness = 255; 102 | } 103 | } 104 | 105 | @Override 106 | public String toString() { 107 | return "enabled=" + mEnabled + " color=#" + String.format("%08X", mColor) 108 | + " onMs=" + mOnMs + " offMs=" + mOffMs + " brightness=" + mBrightness; 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /sdk/src/java/org/lineageos/internal/notification/LightsCapabilities.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2017 The LineageOS Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.lineageos.internal.notification; 7 | 8 | import android.content.Context; 9 | 10 | public final class LightsCapabilities { 11 | // Device has a color adjustable notification light. 12 | public static final int LIGHTS_RGB_NOTIFICATION_LED = 1; 13 | 14 | // Device has a color adjustable battery light. 15 | public static final int LIGHTS_RGB_BATTERY_LED = 2; 16 | 17 | // Deprecated 18 | // public static final int LIGHTS_MULTIPLE_NOTIFICATION_LED = 4; 19 | 20 | // The notification light has adjustable pulsing capability. 21 | public static final int LIGHTS_PULSATING_LED = 8; 22 | 23 | // Device has a multi-segment battery light that is able to 24 | // use the light brightness value to determine how many 25 | // segments to show (in order to represent battery level). 26 | public static final int LIGHTS_SEGMENTED_BATTERY_LED = 16; 27 | 28 | // The notification light supports HAL adjustable brightness 29 | // via the alpha channel. 30 | // Note: if a device notification light supports LIGHTS_RGB_NOTIFICATION_LED 31 | // then HAL support is not necessary for brightness control. In this case, 32 | // brightness support will be provided by lineage-sdk through the scaling of 33 | // RGB color values. 34 | public static final int LIGHTS_ADJUSTABLE_NOTIFICATION_LED_BRIGHTNESS = 32; 35 | 36 | // Device has a battery light. 37 | public static final int LIGHTS_BATTERY_LED = 64; 38 | 39 | // The battery light supports HAL adjustable brightness via 40 | // the alpha channel. 41 | // Note: if a device battery light supports LIGHTS_RGB_BATTERY_LED then HAL 42 | // support is not necessary for brightness control. In this case, 43 | // brightness support will be provided by lineage-sdk through the scaling of 44 | // RGB color values. 45 | public static final int LIGHTS_ADJUSTABLE_BATTERY_LED_BRIGHTNESS = 128; 46 | 47 | // The notification light has non-adjustable pulsing capability. 48 | public static final int LIGHTS_BREATHING_LED = 256; 49 | 50 | public static boolean blinks(Context context) { 51 | final int capabilities = context.getResources().getInteger( 52 | org.lineageos.platform.internal.R.integer.config_deviceLightCapabilities); 53 | return (capabilities & (LIGHTS_PULSATING_LED | LIGHTS_BREATHING_LED)) != 0; 54 | } 55 | 56 | public static boolean supports(Context context, final int capability) { 57 | final int capabilities = context.getResources().getInteger( 58 | org.lineageos.platform.internal.R.integer.config_deviceLightCapabilities); 59 | return (capabilities & capability) != 0; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /sdk/src/java/org/lineageos/internal/notification/LineageNotification.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2017 The LineageOS Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.lineageos.internal.notification; 7 | 8 | public class LineageNotification { 9 | 10 | /////////////////////////////////////////////////// 11 | // Lineage-specific Notification bundle extras 12 | /////////////////////////////////////////////////// 13 | 14 | /** 15 | * Used by light picker in Settings to force 16 | * notification lights on when screen is on. 17 | */ 18 | public static final String EXTRA_FORCE_SHOW_LIGHTS = "lineage.forceShowLights"; 19 | 20 | /** 21 | * Used by light picker in Settings to force 22 | * a specific light brightness. 23 | */ 24 | public static final String EXTRA_FORCE_LIGHT_BRIGHTNESS = "lineage.forceLightBrightness"; 25 | 26 | /** 27 | * Used by light picker in Settings to force 28 | * a specific light color. 29 | */ 30 | public static final String EXTRA_FORCE_COLOR = "lineage.forceColor"; 31 | 32 | /** 33 | * Used by light picker in Settings to force 34 | * a specific light on duration. 35 | * 36 | * Value must be greater than or equal to 0. 37 | */ 38 | public static final String EXTRA_FORCE_LIGHT_ON_MS = "lineage.forceLightOnMs"; 39 | 40 | /** 41 | * Used by light picker in Settings to force 42 | * a specific light off duration. 43 | * 44 | * Value must be greater than or equal to 0. 45 | */ 46 | public static final String EXTRA_FORCE_LIGHT_OFF_MS = "lineage.forceLightOffMs"; 47 | } 48 | -------------------------------------------------------------------------------- /sdk/src/java/org/lineageos/internal/statusbar/LineageStatusBarItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2018 The LineageOS project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.lineageos.internal.statusbar; 7 | 8 | import android.graphics.Rect; 9 | import android.view.View; 10 | import android.view.ViewParent; 11 | 12 | import java.util.ArrayList; 13 | 14 | public class LineageStatusBarItem { 15 | 16 | public interface Manager { 17 | public void addDarkReceiver(DarkReceiver darkReceiver); 18 | public void addVisibilityReceiver(VisibilityReceiver visibilityReceiver); 19 | } 20 | 21 | public interface DarkReceiver { 22 | public void onDarkChanged(ArrayList areas, float darkIntensity, int tint); 23 | public void setFillColors(int darkColor, int lightColor); 24 | } 25 | 26 | public interface VisibilityReceiver { 27 | public void onVisibilityChanged(boolean isVisible); 28 | } 29 | 30 | // Locate parent LineageStatusBarItem.Manager 31 | public static Manager findManager(View v) { 32 | ViewParent parent = v.getParent(); 33 | if (parent == null) { 34 | return null; 35 | } else if (parent instanceof Manager) { 36 | return (Manager) parent; 37 | } else if (parent instanceof View) { 38 | return findManager((View) parent); 39 | } else { 40 | return null; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /sdk/src/java/org/lineageos/internal/util/DeviceKeysConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2018,2021 The LineageOS Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.lineageos.internal.util; 7 | 8 | import android.content.ContentResolver; 9 | import android.os.UserHandle; 10 | 11 | import lineageos.providers.LineageSettings; 12 | 13 | public class DeviceKeysConstants { 14 | // Available custom actions to perform on a key press. 15 | // Must match values for KEY_HOME_LONG_PRESS_ACTION in: 16 | // sdk/src/java/lineageos/providers/LineageSettings.java 17 | public enum Action { 18 | NOTHING, 19 | MENU, 20 | APP_SWITCH, 21 | SEARCH, 22 | VOICE_SEARCH, 23 | IN_APP_SEARCH, 24 | LAUNCH_CAMERA, 25 | SLEEP, 26 | LAST_APP, 27 | SPLIT_SCREEN, 28 | KILL_APP; 29 | 30 | public static Action fromIntSafe(int id) { 31 | if (id < NOTHING.ordinal() || id > Action.values().length) { 32 | return NOTHING; 33 | } 34 | return Action.values()[id]; 35 | } 36 | 37 | public static Action fromSettings(ContentResolver cr, String setting, Action def) { 38 | return fromIntSafe(LineageSettings.System.getIntForUser(cr, 39 | setting, def.ordinal(), UserHandle.USER_CURRENT)); 40 | } 41 | } 42 | 43 | // Masks for checking presence of hardware keys. 44 | // Must match values in: 45 | // lineage/res/res/values/config.xml 46 | public static final int KEY_MASK_HOME = 0x01; 47 | public static final int KEY_MASK_BACK = 0x02; 48 | public static final int KEY_MASK_MENU = 0x04; 49 | public static final int KEY_MASK_ASSIST = 0x08; 50 | public static final int KEY_MASK_APP_SWITCH = 0x10; 51 | public static final int KEY_MASK_CAMERA = 0x20; 52 | public static final int KEY_MASK_VOLUME = 0x40; 53 | } 54 | 55 | -------------------------------------------------------------------------------- /sdk/src/java/org/lineageos/internal/util/LineageLockPatternUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2015 The CyanogenMod Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | package org.lineageos.internal.util; 6 | 7 | import android.content.Context; 8 | 9 | import com.android.internal.widget.LockPatternUtils; 10 | 11 | import lineageos.providers.LineageSettings; 12 | 13 | public class LineageLockPatternUtils extends LockPatternUtils { 14 | public LineageLockPatternUtils(Context context) { 15 | super(context); 16 | } 17 | 18 | public boolean shouldPassToSecurityView(int userId) { 19 | return getBoolean(LineageSettings.Secure.LOCK_PASS_TO_SECURITY_VIEW, false, userId); 20 | } 21 | 22 | public void setPassToSecurityView(boolean enabled, int userId) { 23 | setBoolean(LineageSettings.Secure.LOCK_PASS_TO_SECURITY_VIEW, enabled, userId); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /sdk/src/java/org/lineageos/internal/util/MathUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2016 The CyanogenMod Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | package org.lineageos.internal.util; 6 | 7 | public final class MathUtils { 8 | 9 | /** 10 | * Given a range of values which change continuously in a non-linear way, 11 | * we can map back and forth to a linear scale using some quadratic equations. 12 | * 13 | * The linear scale ranges from 0 -> 1. This method will calculate the 14 | * coefficients needed to solve the conversion functions in the next two methods. 15 | * 16 | * lower = actual value when linear value = 0 17 | * mid = actual value when linear value = .5 18 | * upper actual value when linear value = 1 19 | * 20 | * @param lower 21 | * @param mid 22 | * @param upper 23 | * @return array of coefficients 24 | */ 25 | public static double[] powerCurve(double lower, double mid, double upper) { 26 | final double[] curve = new double[3]; 27 | curve[0] = ((lower * upper) - (mid * mid)) / (lower - (2 * mid) + upper); 28 | curve[1] = Math.pow((mid - lower), 2) / (lower - (2 * mid) + upper); 29 | curve[2] = 2 * Math.log((upper - mid) / (mid - lower)); 30 | return curve; 31 | } 32 | 33 | /** 34 | * Map a value on a power curve to a linear value 35 | * 36 | * @param curve obtained from powerCurve() 37 | * @param value to convert to linear scale 38 | * @return linear value from 0 -> 1 39 | */ 40 | public static double powerCurveToLinear(final double[] curve, double value) { 41 | return Math.log((value - curve[0]) / curve[1]) / curve[2]; 42 | } 43 | 44 | /** 45 | * Map a value on a linear scale to a value on a power curve 46 | * 47 | * @param curve obtained from powerCurve() 48 | * @param value from 0 -> 1 to map onto power curve 49 | * @return actual value on the given curve 50 | */ 51 | public static double linearToPowerCurve(final double[] curve, double value) { 52 | return curve[0] + curve[1] * Math.exp(curve[2] * value); 53 | } 54 | 55 | 56 | } 57 | -------------------------------------------------------------------------------- /sdk/src/java/org/lineageos/internal/util/PowerMenuConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2015 The CyanogenMod Project 3 | * SPDX-FileCopyrightText: 2017-2024 The LineageOS Project 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package org.lineageos.internal.util; 8 | 9 | /* Master list of all actions for the power menu */ 10 | public class PowerMenuConstants { 11 | public static final String GLOBAL_ACTION_KEY_POWER = "power"; 12 | public static final String GLOBAL_ACTION_KEY_RESTART = "restart"; 13 | public static final String GLOBAL_ACTION_KEY_SCREENSHOT = "screenshot"; 14 | public static final String GLOBAL_ACTION_KEY_AIRPLANE = "airplane"; 15 | public static final String GLOBAL_ACTION_KEY_USERS = "users"; 16 | public static final String GLOBAL_ACTION_KEY_SETTINGS = "settings"; 17 | public static final String GLOBAL_ACTION_KEY_LOCKDOWN = "lockdown"; 18 | public static final String GLOBAL_ACTION_KEY_BUGREPORT = "bugreport"; 19 | public static final String GLOBAL_ACTION_KEY_SILENT = "silent"; 20 | public static final String GLOBAL_ACTION_KEY_VOICEASSIST = "voiceassist"; 21 | public static final String GLOBAL_ACTION_KEY_ASSIST = "assist"; 22 | public static final String GLOBAL_ACTION_KEY_LOGOUT = "logout"; 23 | public static final String GLOBAL_ACTION_KEY_EMERGENCY = "emergency"; 24 | public static final String GLOBAL_ACTION_KEY_DEVICECONTROLS = "devicecontrols"; 25 | public static final String GLOBAL_ACTION_KEY_SYSTEM_UPDATE = "system_update"; 26 | 27 | /** 28 | * Advanced restart menu actions 29 | */ 30 | public static final String GLOBAL_ACTION_KEY_RESTART_RECOVERY = "restart_recovery"; 31 | public static final String GLOBAL_ACTION_KEY_RESTART_BOOTLOADER = "restart_bootloader"; 32 | public static final String GLOBAL_ACTION_KEY_RESTART_DOWNLOAD = "restart_download"; 33 | public static final String GLOBAL_ACTION_KEY_RESTART_FASTBOOT = "restart_fastboot"; 34 | 35 | private static String[] ALL_ACTIONS = { 36 | GLOBAL_ACTION_KEY_EMERGENCY, 37 | GLOBAL_ACTION_KEY_LOCKDOWN, 38 | GLOBAL_ACTION_KEY_POWER, 39 | GLOBAL_ACTION_KEY_RESTART, 40 | GLOBAL_ACTION_KEY_SCREENSHOT, 41 | GLOBAL_ACTION_KEY_AIRPLANE, 42 | GLOBAL_ACTION_KEY_USERS, 43 | GLOBAL_ACTION_KEY_SETTINGS, 44 | GLOBAL_ACTION_KEY_BUGREPORT, 45 | GLOBAL_ACTION_KEY_SILENT, 46 | GLOBAL_ACTION_KEY_VOICEASSIST, 47 | GLOBAL_ACTION_KEY_ASSIST, 48 | GLOBAL_ACTION_KEY_DEVICECONTROLS, 49 | GLOBAL_ACTION_KEY_LOGOUT, 50 | GLOBAL_ACTION_KEY_SYSTEM_UPDATE, 51 | }; 52 | 53 | public static String[] getAllActions() { 54 | return ALL_ACTIONS; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /sdk/src/java/org/lineageos/internal/util/PowerMenuUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2017 The LineageOS Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.lineageos.internal.util; 7 | 8 | import android.app.KeyguardManager; 9 | import android.content.Context; 10 | import android.os.UserHandle; 11 | 12 | import lineageos.providers.LineageSettings; 13 | 14 | public final class PowerMenuUtils { 15 | public static boolean isAdvancedRestartPossible(final Context context) { 16 | KeyguardManager km = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE); 17 | boolean keyguardLocked = km.inKeyguardRestrictedInputMode() && km.isKeyguardSecure(); 18 | boolean advancedRestartEnabled = LineageSettings.Secure.getInt(context.getContentResolver(), 19 | LineageSettings.Secure.ADVANCED_REBOOT, 0) == 1; 20 | boolean isPrimaryUser = UserHandle.getCallingUserId() == UserHandle.USER_SYSTEM; 21 | 22 | return advancedRestartEnabled && !keyguardLocked && isPrimaryUser; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /sdk/src/java/org/lineageos/internal/util/ScreenType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2015 The CyanogenMod Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.lineageos.internal.util; 7 | 8 | import android.content.Context; 9 | import android.util.DisplayMetrics; 10 | import android.view.DisplayInfo; 11 | import android.view.WindowManager; 12 | 13 | public class ScreenType { 14 | // Device type reference 15 | private static int sDeviceType = -1; 16 | 17 | // Device types 18 | private static final int DEVICE_PHONE = 0; 19 | private static final int DEVICE_HYBRID = 1; 20 | private static final int DEVICE_TABLET = 2; 21 | 22 | private static int getScreenType(Context context) { 23 | if (sDeviceType == -1) { 24 | WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); 25 | DisplayInfo outDisplayInfo = new DisplayInfo(); 26 | wm.getDefaultDisplay().getDisplayInfo(outDisplayInfo); 27 | int shortSize = Math.min(outDisplayInfo.logicalHeight, outDisplayInfo.logicalWidth); 28 | int shortSizeDp = shortSize * DisplayMetrics.DENSITY_DEFAULT 29 | / outDisplayInfo.logicalDensityDpi; 30 | if (shortSizeDp < 600) { 31 | // 0-599dp: "phone" UI with a separate status & navigation bar 32 | sDeviceType = DEVICE_PHONE; 33 | } else if (shortSizeDp < 720) { 34 | // 600-719dp: "phone" UI with modifications for larger screens 35 | sDeviceType = DEVICE_HYBRID; 36 | } else { 37 | // 720dp: "tablet" UI with a single combined status & navigation bar 38 | sDeviceType = DEVICE_TABLET; 39 | } 40 | } 41 | return sDeviceType; 42 | } 43 | 44 | public static boolean isPhone(Context context) { 45 | return getScreenType(context) == DEVICE_PHONE; 46 | } 47 | 48 | public static boolean isHybrid(Context context) { 49 | return getScreenType(context) == DEVICE_HYBRID; 50 | } 51 | 52 | public static boolean isTablet(Context context) { 53 | return getScreenType(context) == DEVICE_TABLET; 54 | } 55 | } 56 | --------------------------------------------------------------------------------