diff --git a/packages/LineagePreferenceLib/java/lineageos/preference/PartInfo.java b/packages/LineagePreferenceLib/java/lineageos/preference/PartInfo.java index 163616e5..1004f916 100644 --- a/packages/LineagePreferenceLib/java/lineageos/preference/PartInfo.java +++ b/packages/LineagePreferenceLib/java/lineageos/preference/PartInfo.java @@ -1,7 +1,9 @@ /* * SPDX-FileCopyrightText: 2016 The CyanogenMod Project + * SPDX-FileCopyrightText: 2025 The LineageOS Project * SPDX-License-Identifier: Apache-2.0 */ + package lineageos.preference; import android.content.Intent; @@ -10,8 +12,6 @@ import android.os.Parcelable; import java.util.Objects; -import lineageos.os.Concierge; - public class PartInfo implements Parcelable { private static final String TAG = PartInfo.class.getSimpleName(); @@ -42,9 +42,6 @@ public class PartInfo implements Parcelable { } public PartInfo(Parcel parcel) { - Concierge.ParcelInfo parcelInfo = Concierge.receiveParcel(parcel); - int parcelableVersion = parcelInfo.getParcelVersion(); - mName = parcel.readString(); mTitle = parcel.readString(); mSummary = parcel.readString(); @@ -135,8 +132,6 @@ public class PartInfo implements Parcelable { @Override public void writeToParcel(Parcel out, int i) { - Concierge.ParcelInfo parcelInfo = Concierge.prepareParcel(out); - out.writeString(mName); out.writeString(mTitle); out.writeString(mSummary); @@ -144,10 +139,8 @@ public class PartInfo implements Parcelable { out.writeInt(mIconRes); out.writeInt(mAvailable ? 1 : 0); out.writeInt(mXmlRes); - parcelInfo.complete(); } - @Override public boolean equals(Object other) { if (other == null) { diff --git a/sdk/src/java/lineageos/app/Profile.java b/sdk/src/java/lineageos/app/Profile.java old mode 100755 new mode 100644 index 60afa0bf..1796be8d --- a/sdk/src/java/lineageos/app/Profile.java +++ b/sdk/src/java/lineageos/app/Profile.java @@ -1,5 +1,6 @@ /* * SPDX-FileCopyrightText: 2015 The CyanogenMod Project + * SPDX-FileCopyrightText: 2025 The LineageOS Project * SPDX-License-Identifier: Apache-2.0 */ @@ -16,7 +17,7 @@ import android.text.TextUtils; import android.util.Log; import com.android.internal.policy.IKeyguardService; -import lineageos.os.Build; + import lineageos.profiles.AirplaneModeSettings; import lineageos.profiles.BrightnessSettings; import lineageos.profiles.ConnectionSettings; @@ -24,9 +25,6 @@ import lineageos.profiles.LockSettings; import lineageos.profiles.RingModeSettings; import lineageos.profiles.StreamSettings; -import lineageos.os.Concierge; -import lineageos.os.Concierge.ParcelInfo; - import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; @@ -204,36 +202,18 @@ public final class Profile implements Parcelable, Comparable { } private ProfileTrigger(Parcel in) { - // Read parcelable version via the Concierge - ParcelInfo parcelInfo = Concierge.receiveParcel(in); - int parcelableVersion = parcelInfo.getParcelVersion(); - - // Pattern here is that all new members should be added to the end of - // the writeToParcel method. Then we step through each version, until the latest - // API release to help unravel this parcel - if (parcelableVersion >= Build.LINEAGE_VERSION_CODES.BOYSENBERRY) { - mType = in.readInt(); - mId = in.readString(); - mState = in.readInt(); - mName = in.readString(); - } - - // Complete parcel info for the concierge - parcelInfo.complete(); + mType = in.readInt(); + mId = in.readString(); + mState = in.readInt(); + mName = in.readString(); } @Override public void writeToParcel(Parcel dest, int flags) { - // Tell the concierge to prepare the parcel - ParcelInfo parcelInfo = Concierge.prepareParcel(dest); - dest.writeInt(mType); dest.writeString(mId); dest.writeInt(mState); dest.writeString(mName); - - // Complete the parcel info for the concierge - parcelInfo.complete(); } @Override @@ -513,10 +493,6 @@ public final class Profile implements Parcelable, Comparable { /** @hide */ @Override public void writeToParcel(Parcel dest, int flags) { - // Tell the concierge to prepare the parcel - ParcelInfo parcelInfo = Concierge.prepareParcel(dest); - - // === BOYSENBERRY === if (!TextUtils.isEmpty(mName)) { dest.writeInt(1); dest.writeString(mName); @@ -595,8 +571,6 @@ public final class Profile implements Parcelable, Comparable { } dest.writeTypedArray(mTriggers.values().toArray(new ProfileTrigger[0]), flags); dest.writeInt(mDozeMode); - - // === ELDERBERRY === dest.writeInt(mNotificationLightMode); if (networkConnectionSubIds != null && !networkConnectionSubIds.isEmpty()) { @@ -606,88 +580,68 @@ public final class Profile implements Parcelable, Comparable { } else { dest.writeInt(0); } - - // Complete the parcel info for the concierge - parcelInfo.complete(); } /** @hide */ public void readFromParcel(Parcel in) { - // Read parcelable version via the Concierge - ParcelInfo parcelInfo = Concierge.receiveParcel(in); - int parcelableVersion = parcelInfo.getParcelVersion(); - - // Pattern here is that all new members should be added to the end of - // the writeToParcel method. Then we step through each version, until the latest - // API release to help unravel this parcel - if (parcelableVersion >= Build.LINEAGE_VERSION_CODES.BOYSENBERRY) { - if (in.readInt() != 0) { - mName = in.readString(); - } - if (in.readInt() != 0) { - mNameResId = in.readInt(); - } - if (in.readInt() != 0) { - mUuid = ParcelUuid.CREATOR.createFromParcel(in).getUuid(); - } - if (in.readInt() != 0) { - for (Parcelable parcel : in.readParcelableArray(null)) { - ParcelUuid u = (ParcelUuid) parcel; - mSecondaryUuids.add(u.getUuid()); - } - } - mStatusBarIndicator = (in.readInt() == 1); - mProfileType = in.readInt(); - mDirty = (in.readInt() == 1); - if (in.readInt() != 0) { - for (ProfileGroup group : in.createTypedArray(ProfileGroup.CREATOR)) { - profileGroups.put(group.getUuid(), group); - if (group.isDefaultGroup()) { - mDefaultGroup = group; - } - } - } - if (in.readInt() != 0) { - for (StreamSettings stream : in.createTypedArray(StreamSettings.CREATOR)) { - streams.put(stream.getStreamId(), stream); - } - } - if (in.readInt() != 0) { - for (ConnectionSettings connection : - in.createTypedArray(ConnectionSettings.CREATOR)) { - connections.put(connection.getConnectionId(), connection); - } - } - if (in.readInt() != 0) { - mRingMode = RingModeSettings.CREATOR.createFromParcel(in); - } - if (in.readInt() != 0) { - mAirplaneMode = AirplaneModeSettings.CREATOR.createFromParcel(in); - } - if (in.readInt() != 0) { - mBrightness = BrightnessSettings.CREATOR.createFromParcel(in); - } - if (in.readInt() != 0) { - mScreenLockMode = LockSettings.CREATOR.createFromParcel(in); - } - for (ProfileTrigger trigger : in.createTypedArray(ProfileTrigger.CREATOR)) { - mTriggers.put(trigger.mId, trigger); - } - mDozeMode = in.readInt(); + if (in.readInt() != 0) { + mName = in.readString(); } - if (parcelableVersion >= Build.LINEAGE_VERSION_CODES.ELDERBERRY) { - mNotificationLightMode = in.readInt(); - if (in.readInt() != 0) { - for (ConnectionSettings connection : - in.createTypedArray(ConnectionSettings.CREATOR)) { - // elderberry can do msim connections - networkConnectionSubIds.put(connection.getSubId(), connection); + if (in.readInt() != 0) { + mNameResId = in.readInt(); + } + if (in.readInt() != 0) { + mUuid = ParcelUuid.CREATOR.createFromParcel(in).getUuid(); + } + if (in.readInt() != 0) { + for (Parcelable parcel : in.readParcelableArray(null)) { + ParcelUuid u = (ParcelUuid) parcel; + mSecondaryUuids.add(u.getUuid()); + } + } + mStatusBarIndicator = (in.readInt() == 1); + mProfileType = in.readInt(); + mDirty = (in.readInt() == 1); + if (in.readInt() != 0) { + for (ProfileGroup group : in.createTypedArray(ProfileGroup.CREATOR)) { + profileGroups.put(group.getUuid(), group); + if (group.isDefaultGroup()) { + mDefaultGroup = group; } } } - - // Complete the parcel info for the concierge - parcelInfo.complete(); + if (in.readInt() != 0) { + for (StreamSettings stream : in.createTypedArray(StreamSettings.CREATOR)) { + streams.put(stream.getStreamId(), stream); + } + } + if (in.readInt() != 0) { + for (ConnectionSettings connection : in.createTypedArray(ConnectionSettings.CREATOR)) { + connections.put(connection.getConnectionId(), connection); + } + } + if (in.readInt() != 0) { + mRingMode = RingModeSettings.CREATOR.createFromParcel(in); + } + if (in.readInt() != 0) { + mAirplaneMode = AirplaneModeSettings.CREATOR.createFromParcel(in); + } + if (in.readInt() != 0) { + mBrightness = BrightnessSettings.CREATOR.createFromParcel(in); + } + if (in.readInt() != 0) { + mScreenLockMode = LockSettings.CREATOR.createFromParcel(in); + } + for (ProfileTrigger trigger : in.createTypedArray(ProfileTrigger.CREATOR)) { + mTriggers.put(trigger.mId, trigger); + } + mDozeMode = in.readInt(); + mNotificationLightMode = in.readInt(); + if (in.readInt() != 0) { + for (ConnectionSettings connection : in.createTypedArray(ConnectionSettings.CREATOR)) { + networkConnectionSubIds.put(connection.getSubId(), connection); + } + } } /** @@ -1150,8 +1104,7 @@ public final class Profile implements Parcelable, Comparable { } if (name.equals("connectionDescriptor")) { ConnectionSettings cs = ConnectionSettings.fromXml(xpp, context); - if (Build.LINEAGE_VERSION.SDK_INT >= Build.LINEAGE_VERSION_CODES.ELDERBERRY - && cs.getConnectionId() == ConnectionSettings.PROFILE_CONNECTION_2G3G4G) { + if (cs.getConnectionId() == ConnectionSettings.PROFILE_CONNECTION_2G3G4G) { profile.networkConnectionSubIds.put(cs.getSubId(), cs); } else { profile.connections.put(cs.getConnectionId(), cs); diff --git a/sdk/src/java/lineageos/app/ProfileGroup.java b/sdk/src/java/lineageos/app/ProfileGroup.java index 2832e921..cc71794d 100644 --- a/sdk/src/java/lineageos/app/ProfileGroup.java +++ b/sdk/src/java/lineageos/app/ProfileGroup.java @@ -1,5 +1,6 @@ /* * SPDX-FileCopyrightText: 2015 The CyanogenMod Project + * SPDX-FileCopyrightText: 2025 The LineageOS Project * SPDX-License-Identifier: Apache-2.0 */ @@ -18,11 +19,6 @@ import android.os.ParcelUuid; import android.text.TextUtils; import android.util.Log; -import lineageos.os.Build; - -import lineageos.os.Concierge; -import lineageos.os.Concierge.ParcelInfo; - import java.io.IOException; import java.util.UUID; @@ -258,10 +254,6 @@ public final class ProfileGroup implements Parcelable { /** @hide */ @Override public void writeToParcel(Parcel dest, int flags) { - // Tell the concierge to prepare the parcel - ParcelInfo parcelInfo = Concierge.prepareParcel(dest); - - // === BOYSENBERRY === dest.writeString(mName); new ParcelUuid(mUuid).writeToParcel(dest, 0); dest.writeInt(mDefaultGroup ? 1 : 0); @@ -272,36 +264,21 @@ public final class ProfileGroup implements Parcelable { dest.writeString(mRingerMode.name()); dest.writeString(mVibrateMode.name()); dest.writeString(mLightsMode.name()); - - // Complete the parcel info for the concierge - parcelInfo.complete(); } /** @hide */ public void readFromParcel(Parcel in) { - // Read parcelable version via the Concierge - ParcelInfo parcelInfo = Concierge.receiveParcel(in); - int parcelableVersion = parcelInfo.getParcelVersion(); + mName = in.readString(); + mUuid = ParcelUuid.CREATOR.createFromParcel(in).getUuid(); + mDefaultGroup = in.readInt() != 0; + mDirty = in.readInt() != 0; + mSoundOverride = in.readParcelable(null); + mRingerOverride = in.readParcelable(null); - // Pattern here is that all new members should be added to the end of - // the writeToParcel method. Then we step through each version, until the latest - // API release to help unravel this parcel - if (parcelableVersion >= Build.LINEAGE_VERSION_CODES.BOYSENBERRY) { - mName = in.readString(); - mUuid = ParcelUuid.CREATOR.createFromParcel(in).getUuid(); - mDefaultGroup = in.readInt() != 0; - mDirty = in.readInt() != 0; - mSoundOverride = in.readParcelable(null); - mRingerOverride = in.readParcelable(null); - - mSoundMode = Mode.valueOf(Mode.class, in.readString()); - mRingerMode = Mode.valueOf(Mode.class, in.readString()); - mVibrateMode = Mode.valueOf(Mode.class, in.readString()); - mLightsMode = Mode.valueOf(Mode.class, in.readString()); - } - - // Complete parcel info for the concierge - parcelInfo.complete(); + mSoundMode = Mode.valueOf(Mode.class, in.readString()); + mRingerMode = Mode.valueOf(Mode.class, in.readString()); + mVibrateMode = Mode.valueOf(Mode.class, in.readString()); + mLightsMode = Mode.valueOf(Mode.class, in.readString()); } public enum Mode { diff --git a/sdk/src/java/lineageos/hardware/DisplayMode.java b/sdk/src/java/lineageos/hardware/DisplayMode.java index edcf888a..e2fa2d5c 100644 --- a/sdk/src/java/lineageos/hardware/DisplayMode.java +++ b/sdk/src/java/lineageos/hardware/DisplayMode.java @@ -1,5 +1,6 @@ /* * SPDX-FileCopyrightText: 2015 The CyanogenMod Project + * SPDX-FileCopyrightText: 2025 The LineageOS Project * SPDX-License-Identifier: Apache-2.0 */ @@ -8,10 +9,6 @@ package lineageos.hardware; import android.os.Parcel; import android.os.Parcelable; -import lineageos.os.Build; -import lineageos.os.Concierge; -import lineageos.os.Concierge.ParcelInfo; - /** * Display Modes API * @@ -36,27 +33,8 @@ public class DisplayMode implements Parcelable { } private DisplayMode(Parcel parcel) { - // Read parcelable version via the Concierge - ParcelInfo parcelInfo = Concierge.receiveParcel(parcel); - int parcelableVersion = parcelInfo.getParcelVersion(); - - // temp vars - int tmpId = -1; - String tmpName = null; - - if (parcelableVersion >= Build.LINEAGE_VERSION_CODES.BOYSENBERRY) { - tmpId = parcel.readInt(); - if (parcel.readInt() != 0) { - tmpName = parcel.readString(); - } - } - - // set temps - this.id = tmpId; - this.name = tmpName; - - // Complete parcel info for the concierge - parcelInfo.complete(); + this.id = parcel.readInt(); + this.name = parcel.readInt() != 0 ? parcel.readString() : null; } @Override @@ -66,10 +44,6 @@ public class DisplayMode implements Parcelable { @Override public void writeToParcel(Parcel out, int flags) { - // Tell the concierge to prepare the parcel - ParcelInfo parcelInfo = Concierge.prepareParcel(out); - - // ==== BOYSENBERRY ===== out.writeInt(id); if (name != null) { out.writeInt(1); @@ -77,9 +51,6 @@ public class DisplayMode implements Parcelable { } else { out.writeInt(0); } - - // Complete the parcel info for the concierge - parcelInfo.complete(); } /** @hide */ diff --git a/sdk/src/java/lineageos/hardware/LiveDisplayConfig.java b/sdk/src/java/lineageos/hardware/LiveDisplayConfig.java index 308dea65..27b8df24 100644 --- a/sdk/src/java/lineageos/hardware/LiveDisplayConfig.java +++ b/sdk/src/java/lineageos/hardware/LiveDisplayConfig.java @@ -1,5 +1,6 @@ /* * SPDX-FileCopyrightText: 2016 The CyanogenMod Project + * SPDX-FileCopyrightText: 2025 The LineageOS Project * SPDX-License-Identifier: Apache-2.0 */ package lineageos.hardware; @@ -20,10 +21,6 @@ import java.util.Arrays; import java.util.BitSet; import java.util.List; -import lineageos.os.Build; -import lineageos.os.Concierge; -import lineageos.os.Concierge.ParcelInfo; - /** * Holder class for LiveDisplay static configuration. * @@ -83,61 +80,25 @@ public class LiveDisplayConfig implements Parcelable { } private LiveDisplayConfig(Parcel parcel) { - // Read parcelable version via the Concierge - ParcelInfo parcelInfo = Concierge.receiveParcel(parcel); - int parcelableVersion = parcelInfo.getParcelVersion(); - - // temp vars - long capabilities = 0; - int defaultMode = 0; - int defaultDayTemperature = -1; - int defaultNightTemperature = -1; - boolean defaultAutoContrast = false; - boolean defaultAutoOutdoorMode = false; - boolean defaultCABC = false; - boolean defaultColorEnhancement = false; - int minColorTemperature = 0; - int maxColorTemperature = 0; - int minColorBalance = 0; - int maxColorBalance = 0; float[] paRanges = new float[10]; - if (parcelableVersion >= Build.LINEAGE_VERSION_CODES.FIG) { - capabilities = parcel.readLong(); - defaultMode = parcel.readInt(); - defaultDayTemperature = parcel.readInt(); - defaultNightTemperature = parcel.readInt(); - defaultAutoContrast = parcel.readInt() == 1; - defaultAutoOutdoorMode = parcel.readInt() == 1; - defaultCABC = parcel.readInt() == 1; - defaultColorEnhancement = parcel.readInt() == 1; - minColorTemperature = parcel.readInt(); - maxColorTemperature = parcel.readInt(); - minColorBalance = parcel.readInt(); - maxColorBalance = parcel.readInt(); - parcel.readFloatArray(paRanges); - } - - // set temps - mCapabilities = BitSet.valueOf(new long[] { capabilities }); + mCapabilities = BitSet.valueOf(new long[] { parcel.readLong() }); mAllModes.set(MODE_FIRST, MODE_LAST); - mDefaultMode = defaultMode; - mDefaultDayTemperature = defaultDayTemperature; - mDefaultNightTemperature = defaultNightTemperature; - mDefaultAutoContrast = defaultAutoContrast; - mDefaultAutoOutdoorMode = defaultAutoOutdoorMode; - mDefaultCABC = defaultCABC; - mDefaultColorEnhancement = defaultColorEnhancement; - mColorTemperatureRange = Range.create(minColorTemperature, maxColorTemperature); - mColorBalanceRange = Range.create(minColorBalance, maxColorBalance); + mDefaultMode = parcel.readInt(); + mDefaultDayTemperature = parcel.readInt(); + mDefaultNightTemperature = parcel.readInt(); + mDefaultAutoContrast = parcel.readInt() == 1; + mDefaultAutoOutdoorMode = parcel.readInt() == 1; + mDefaultCABC = parcel.readInt() == 1; + mDefaultColorEnhancement = parcel.readInt() == 1; + mColorTemperatureRange = Range.create(parcel.readInt(), parcel.readInt()); + mColorBalanceRange = Range.create(parcel.readInt(), parcel.readInt()); + parcel.readFloatArray(paRanges); mHueRange = Range.create(paRanges[0], paRanges[1]); mSaturationRange = Range.create(paRanges[2], paRanges[3]); mIntensityRange = Range.create(paRanges[4], paRanges[5]); mContrastRange = Range.create(paRanges[6], paRanges[7]); mSaturationThresholdRange = Range.create(paRanges[8], paRanges[9]); - - // Complete parcel info for the concierge - parcelInfo.complete(); } @Override @@ -172,10 +133,6 @@ public class LiveDisplayConfig implements Parcelable { @Override public void writeToParcel(Parcel out, int flags) { - // Tell the concierge to prepare the parcel - ParcelInfo parcelInfo = Concierge.prepareParcel(out); - - // ==== FIG ===== long[] caps = mCapabilities.toLongArray(); out.writeLong(caps != null && caps.length > 0 ? caps[0] : 0L); out.writeInt(mDefaultMode); @@ -195,9 +152,6 @@ public class LiveDisplayConfig implements Parcelable { mIntensityRange.getLower(), mIntensityRange.getUpper(), mContrastRange.getLower(), mContrastRange.getUpper(), mSaturationThresholdRange.getLower(), mSaturationThresholdRange.getUpper() } ); - - // Complete the parcel info for the concierge - parcelInfo.complete(); } /** diff --git a/sdk/src/java/lineageos/os/Build.java b/sdk/src/java/lineageos/os/Build.java deleted file mode 100644 index 7e6d15a9..00000000 --- a/sdk/src/java/lineageos/os/Build.java +++ /dev/null @@ -1,189 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2015 The CyanogenMod Project - * SPDX-License-Identifier: Apache-2.0 - */ - -package lineageos.os; - -import android.os.SystemProperties; -import android.text.TextUtils; -import android.util.SparseArray; - -/** - * Information about the current LineageOS build, extracted from system properties. - */ -public class Build { - /** Value used for when a build property is unknown. */ - public static final String UNKNOWN = "unknown"; - - /** A build ID utilized to distinguish lineageos versions */ - public static final String LINEAGEOS_VERSION = getString("ro.lineage.version"); - - /** A build ID string meant for displaying to the user */ - public static final String LINEAGEOS_DISPLAY_VERSION = getString("ro.lineage.display.version"); - - private static final SparseArray sdkMap; - static - { - sdkMap = new SparseArray(); - sdkMap.put(LINEAGE_VERSION_CODES.APRICOT, "Apricot"); - sdkMap.put(LINEAGE_VERSION_CODES.BOYSENBERRY, "Boysenberry"); - sdkMap.put(LINEAGE_VERSION_CODES.CANTALOUPE, "Cantaloupe"); - sdkMap.put(LINEAGE_VERSION_CODES.DRAGON_FRUIT, "Dragon Fruit"); - sdkMap.put(LINEAGE_VERSION_CODES.ELDERBERRY, "Elderberry"); - sdkMap.put(LINEAGE_VERSION_CODES.FIG, "Fig"); - sdkMap.put(LINEAGE_VERSION_CODES.GUAVA, "Guava"); - sdkMap.put(LINEAGE_VERSION_CODES.HACKBERRY, "Hackberry"); - sdkMap.put(LINEAGE_VERSION_CODES.ILAMA, "Ilama"); - } - - /** Various version strings. */ - public static class LINEAGE_VERSION { - /** - * The user-visible SDK version of the framework; its possible - * values are defined in {@link Build.LINEAGE_VERSION_CODES}. - * - * Will return 0 if the device does not support the Lineage SDK. - */ - public static final int SDK_INT = SystemProperties.getInt( - "ro.lineage.build.version.plat.sdk", 0); - } - - /** - * Enumeration of the currently known SDK version codes. These are the - * values that can be found in {@link LINEAGE_VERSION#SDK_INT}. Version numbers - * increment monotonically with each official platform release. - * - * To programmatically validate that a given API is available for use on the device, - * you can quickly check if the SDK_INT from the OS is provided and is greater or equal - * to the API level that your application is targeting. - * - *

Example for validating that Profiles API is available - *

-     * private void removeActiveProfile() {
-     *     Make sure we're running on BoysenBerry or higher to use Profiles API
-     *     if (Build.LINEAGE_VERSION.SDK_INT >= Build.LINEAGE_VERSION_CODES.BOYSENBERRY) {
-     *         ProfileManager profileManager = ProfileManager.getInstance(this);
-     *         Profile activeProfile = profileManager.getActiveProfile();
-     *         if (activeProfile != null) {
-     *             profileManager.removeProfile(activeProfile);
-     *         }
-     *     }
-     * }
-     * 
- */ - public static class LINEAGE_VERSION_CODES { - /** - * June 2015: The first version of the platform sdk for CyanogenMod - */ - public static final int APRICOT = 1; - - /** - * September 2015: The second version of the platform sdk for CyanogenMod - * - *

Applications targeting this or a later release will get these - * new features:

- * - */ - public static final int BOYSENBERRY = 2; - - /** - * November - December 2015: The third iteration of the platform sdk for CyanogenMod - * Transition api level that is mostly 1:1 to {@link #BOYSENBERRY} - */ - public static final int CANTALOUPE = 3; - - /** - * January 2016: The 4th iteration of the platform sdk for CyanogenMod - * - *

Applications targeting this or a later version will get access to these - * new features:

- * - */ - public static final int DRAGON_FRUIT = 4; - - /** - * April 2016: The 5th iteration of the platform sdk for CyanogenMod - * - *

Applications targeting this or a later version will get access to these - * new features!

- * - */ - public static final int ELDERBERRY = 5; - - /** - * August 2016: The 6th iteration of the platform sdk for CyanogenMod - * - *

Applications targeting this or a later version will get access to these - * new features!

- * - * - * Signing out, Adnan \u270C - */ - public static final int FIG = 6; - - /** - * January 2017: Unreleased preliminary version starting from CM14 - */ - public static final int GUAVA = 7; - - /** - * February 2018: Unreleased preliminary version starting from LineageOS 15.1 - *

Unused APIs have been removed.

- */ - public static final int HACKBERRY = 8; - - /** - * March 2018: The 1st iteration of the platform sdk for LineageOS - *

Applications targeting this or a later version will get access to these - * new features!

- * - */ - public static final int ILAMA = 9; - } - - /** - * Retrieve the name for the SDK int - * @param sdkInt - * @return name of the SDK int, {@link #UNKNOWN) if not known - */ - public static String getNameForSDKInt(int sdkInt) { - final String name = sdkMap.get(sdkInt); - if (TextUtils.isEmpty(name)) { - return UNKNOWN; - } - return name; - } - - private static String getString(String property) { - return SystemProperties.get(property, UNKNOWN); - } -} diff --git a/sdk/src/java/lineageos/os/Concierge.java b/sdk/src/java/lineageos/os/Concierge.java deleted file mode 100644 index 8f4503e6..00000000 --- a/sdk/src/java/lineageos/os/Concierge.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2016 The CyanogenMod Project - * SPDX-License-Identifier: Apache-2.0 - */ - -package lineageos.os; - -import android.os.Parcel; - -import lineageos.os.Build.LINEAGE_VERSION_CODES; - -/** - * Simply, Concierge handles your parcels and makes sure they get marshalled and unmarshalled - * correctly when cross IPC boundaries even when there is a version mismatch between the client - * sdk level and the framework implementation. - * - *

On incoming parcel (to be unmarshalled): - * - *

- *     ParcelInfo incomingParcelInfo = Concierge.receiveParcel(incomingParcel);
- *     int parcelableVersion = incomingParcelInfo.getParcelVersion();
- *
- *     // Do unmarshalling steps here iterating over every plausible version
- *
- *     // Complete the process
- *     incomingParcelInfo.complete();
- * 
- * - *

On outgoing parcel (to be marshalled): - * - *

- *     ParcelInfo outgoingParcelInfo = Concierge.prepareParcel(incomingParcel);
- *
- *     // Do marshalling steps here iterating over every plausible version
- *
- *     // Complete the process
- *     outgoingParcelInfo.complete();
- * 
- */ -public final class Concierge { - - /** Not instantiable */ - private Concierge() { - // Don't instantiate - } - - /** - * Since there might be a case where new versions of the lineage framework use applications running - * old versions of the protocol (and thus old versions of this class), we need a versioning - * system for the parcels sent between the core framework and its sdk users. - * - * This parcelable version should be the latest version API version listed in - * {@link LINEAGE_VERSION_CODES} - * @hide - */ - public static final int PARCELABLE_VERSION = LINEAGE_VERSION_CODES.ILAMA; - - /** - * Tell the concierge to receive our parcel, so we can get information from it. - * - * MUST CALL {@link ParcelInfo#complete()} AFTER UNMARSHALLING. - * - * @param parcel Incoming parcel to be unmarshalled - * @return {@link ParcelInfo} containing parcel information, specifically the version. - */ - public static ParcelInfo receiveParcel(Parcel parcel) { - return new ParcelInfo(parcel); - } - - /** - * Prepare a parcel for the Concierge. - * - * MUST CALL {@link ParcelInfo#complete()} AFTER MARSHALLING. - * - * @param parcel Outgoing parcel to be marshalled - * @return {@link ParcelInfo} containing parcel information, specifically the version. - */ - public static ParcelInfo prepareParcel(Parcel parcel) { - return new ParcelInfo(parcel, PARCELABLE_VERSION); - } - - /** - * Parcel header info specific to the Parcel object that is passed in via - * {@link #prepareParcel(Parcel)} or {@link #receiveParcel(Parcel)}. The exposed method - * of {@link #getParcelVersion()} gets the api level of the parcel object. - */ - public final static class ParcelInfo { - private Parcel mParcel; - private int mParcelableVersion; - private int mParcelableSize; - private int mStartPosition; - private int mSizePosition; - private boolean mCreation = false; - - ParcelInfo(Parcel parcel) { - mCreation = false; - mParcel = parcel; - mParcelableVersion = parcel.readInt(); - mParcelableSize = parcel.readInt(); - mStartPosition = parcel.dataPosition(); - } - - ParcelInfo(Parcel parcel, int parcelableVersion) { - mCreation = true; - mParcel = parcel; - mParcelableVersion = parcelableVersion; - - // Write parcelable version, make sure to define explicit changes - // within {@link #PARCELABLE_VERSION); - mParcel.writeInt(mParcelableVersion); - - // Inject a placeholder that will store the parcel size from this point on - // (not including the size itself). - mSizePosition = parcel.dataPosition(); - mParcel.writeInt(0); - mStartPosition = parcel.dataPosition(); - } - - /** - * Get the parcel version from the {@link Parcel} received by the Concierge. - * @return {@link #PARCELABLE_VERSION} of the {@link Parcel} - */ - public int getParcelVersion() { - return mParcelableVersion; - } - - /** - * Complete the {@link ParcelInfo} for the Concierge. - */ - public void complete() { - if (mCreation) { - // Go back and write size - mParcelableSize = mParcel.dataPosition() - mStartPosition; - mParcel.setDataPosition(mSizePosition); - mParcel.writeInt(mParcelableSize); - mParcel.setDataPosition(mStartPosition + mParcelableSize); - } else { - mParcel.setDataPosition(mStartPosition + mParcelableSize); - } - } - } -} diff --git a/sdk/src/java/lineageos/profiles/AirplaneModeSettings.java b/sdk/src/java/lineageos/profiles/AirplaneModeSettings.java index 037feec4..ed28d81c 100644 --- a/sdk/src/java/lineageos/profiles/AirplaneModeSettings.java +++ b/sdk/src/java/lineageos/profiles/AirplaneModeSettings.java @@ -1,6 +1,6 @@ /* * SPDX-FileCopyrightText: 2015 The CyanogenMod Project - * SPDX-FileCopyrightText: 2020 The LineageOS Project + * SPDX-FileCopyrightText: 2020-2025 The LineageOS Project * SPDX-License-Identifier: Apache-2.0 */ @@ -12,14 +12,9 @@ import android.provider.Settings; import android.os.Parcel; import android.os.Parcelable; -import lineageos.os.Build; -import lineageos.os.Concierge; -import lineageos.os.Concierge.ParcelInfo; - import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; - import java.io.IOException; /** @@ -181,34 +176,15 @@ public final class AirplaneModeSettings implements Parcelable { /** @hide */ @Override public void writeToParcel(Parcel dest, int flags) { - // Tell the concierge to prepare the parcel - ParcelInfo parcelInfo = Concierge.prepareParcel(dest); - - // === BOYSENBERRY === dest.writeInt(mOverride ? 1 : 0); dest.writeInt(mValue); dest.writeInt(mDirty ? 1 : 0); - - // Complete the parcel info for the concierge - parcelInfo.complete(); } /** @hide */ public void readFromParcel(Parcel in) { - // Read parcelable version via the Concierge - ParcelInfo parcelInfo = Concierge.receiveParcel(in); - int parcelableVersion = parcelInfo.getParcelVersion(); - - // Pattern here is that all new members should be added to the end of - // the writeToParcel method. Then we step through each version, until the latest - // API release to help unravel this parcel - if (parcelableVersion >= Build.LINEAGE_VERSION_CODES.BOYSENBERRY) { - mOverride = in.readInt() != 0; - mValue = in.readInt(); - mDirty = in.readInt() != 0; - } - - // Complete parcel info for the concierge - parcelInfo.complete(); + mOverride = in.readInt() != 0; + mValue = in.readInt(); + mDirty = in.readInt() != 0; } } diff --git a/sdk/src/java/lineageos/profiles/BrightnessSettings.java b/sdk/src/java/lineageos/profiles/BrightnessSettings.java index 6069253f..32687c76 100644 --- a/sdk/src/java/lineageos/profiles/BrightnessSettings.java +++ b/sdk/src/java/lineageos/profiles/BrightnessSettings.java @@ -1,5 +1,6 @@ /* * SPDX-FileCopyrightText: 2015 The CyanogenMod Project + * SPDX-FileCopyrightText: 2025 The LineageOS Project * SPDX-License-Identifier: Apache-2.0 */ @@ -10,14 +11,9 @@ import android.provider.Settings; import android.os.Parcel; import android.os.Parcelable; -import lineageos.os.Build; -import lineageos.os.Concierge; -import lineageos.os.Concierge.ParcelInfo; - import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; - import java.io.IOException; /** @@ -178,34 +174,15 @@ public final class BrightnessSettings implements Parcelable { /** @hide */ @Override public void writeToParcel(Parcel dest, int flags) { - // Tell the concierge to prepare the parcel - ParcelInfo parcelInfo = Concierge.prepareParcel(dest); - - // === BOYSENBERRY === dest.writeInt(mOverride ? 1 : 0); dest.writeInt(mValue); dest.writeInt(mDirty ? 1 : 0); - - // Complete the parcel info for the concierge - parcelInfo.complete(); } /** @hide */ public void readFromParcel(Parcel in) { - // Read parcelable version via the Concierge - ParcelInfo parcelInfo = Concierge.receiveParcel(in); - int parcelableVersion = parcelInfo.getParcelVersion(); - - // Pattern here is that all new members should be added to the end of - // the writeToParcel method. Then we step through each version, until the latest - // API release to help unravel this parcel - if (parcelableVersion >= Build.LINEAGE_VERSION_CODES.BOYSENBERRY) { - mOverride = in.readInt() != 0; - mValue = in.readInt(); - mDirty = in.readInt() != 0; - } - - // Complete parcel info for the concierge - parcelInfo.complete(); + mOverride = in.readInt() != 0; + mValue = in.readInt(); + mDirty = in.readInt() != 0; } } diff --git a/sdk/src/java/lineageos/profiles/ConnectionSettings.java b/sdk/src/java/lineageos/profiles/ConnectionSettings.java index 84a9e43a..33c251da 100644 --- a/sdk/src/java/lineageos/profiles/ConnectionSettings.java +++ b/sdk/src/java/lineageos/profiles/ConnectionSettings.java @@ -1,6 +1,6 @@ /* * SPDX-FileCopyrightText: 2015 The CyanogenMod Project - * SPDX-FileCopyrightText: 2020-2024 The LineageOS Project + * SPDX-FileCopyrightText: 2020-2025 The LineageOS Project * SPDX-License-Identifier: Apache-2.0 */ @@ -24,10 +24,6 @@ import android.telephony.TelephonyManager; import com.android.internal.telephony.RILConstants; -import lineageos.os.Build; -import lineageos.os.Concierge; -import lineageos.os.Concierge.ParcelInfo; - import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; @@ -271,35 +267,10 @@ public final class ConnectionSettings implements Parcelable { } break; case PROFILE_CONNECTION_2G3G4G: - if (Build.LINEAGE_VERSION.SDK_INT >= Build.LINEAGE_VERSION_CODES.ELDERBERRY) { - Intent intent = new Intent(ACTION_MODIFY_NETWORK_MODE); - intent.putExtra(EXTRA_NETWORK_MODE, getValue()); - intent.putExtra(EXTRA_SUB_ID, getSubId()); - context.sendBroadcast(intent, "com.android.phone.CHANGE_NETWORK_MODE"); - } else { - Intent intent = new Intent(ACTION_MODIFY_NETWORK_MODE); - switch(getValue()) { - case LINEAGE_MODE_2G: - intent.putExtra(EXTRA_NETWORK_MODE, RILConstants.NETWORK_MODE_GSM_ONLY); - break; - case LINEAGE_MODE_3G: - intent.putExtra(EXTRA_NETWORK_MODE, RILConstants.NETWORK_MODE_WCDMA_ONLY); - break; - case LINEAGE_MODE_4G: - intent.putExtra(EXTRA_NETWORK_MODE, RILConstants.NETWORK_MODE_LTE_ONLY); - break; - case LINEAGE_MODE_2G3G: - intent.putExtra(EXTRA_NETWORK_MODE, RILConstants.NETWORK_MODE_WCDMA_PREF); - break; - case LINEAGE_MODE_ALL: - intent.putExtra(EXTRA_NETWORK_MODE, - RILConstants.NETWORK_MODE_LTE_GSM_WCDMA); - break; - default: - return; - } - context.sendBroadcast(intent); - } + Intent intent = new Intent(ACTION_MODIFY_NETWORK_MODE); + intent.putExtra(EXTRA_NETWORK_MODE, getValue()); + intent.putExtra(EXTRA_SUB_ID, getSubId()); + context.sendBroadcast(intent, "com.android.phone.CHANGE_NETWORK_MODE"); break; case PROFILE_CONNECTION_BLUETOOTH: int btstate = bta.getState(); @@ -399,11 +370,9 @@ public final class ConnectionSettings implements Parcelable { builder.append("\n"); builder.append(mOverride); builder.append("\n"); - if (Build.LINEAGE_VERSION.SDK_INT >= Build.LINEAGE_VERSION_CODES.ELDERBERRY) { - if (mConnectionId == PROFILE_CONNECTION_2G3G4G - && mSubId != SubscriptionManager.INVALID_SUBSCRIPTION_ID) { - builder.append("").append(mSubId).append("\n"); - } + if (mConnectionId == PROFILE_CONNECTION_2G3G4G + && mSubId != SubscriptionManager.INVALID_SUBSCRIPTION_ID) { + builder.append("").append(mSubId).append("\n"); } builder.append("\n"); } @@ -416,48 +385,26 @@ public final class ConnectionSettings implements Parcelable { /** @hide */ @Override public void writeToParcel(Parcel dest, int flags) { - // Tell the concierge to prepare the parcel - ParcelInfo parcelInfo = Concierge.prepareParcel(dest); - - // === BOYSENBERRY === dest.writeInt(mConnectionId); dest.writeInt(mOverride ? 1 : 0); dest.writeInt(mValue); dest.writeInt(mDirty ? 1 : 0); - // === ELDERBERRY === if (mConnectionId == PROFILE_CONNECTION_2G3G4G) { dest.writeInt(mSubId); } - - // Complete the parcel info for the concierge - parcelInfo.complete(); } /** @hide */ public void readFromParcel(Parcel in) { - // Read parcelable version via the Concierge - ParcelInfo parcelInfo = Concierge.receiveParcel(in); - int parcelableVersion = parcelInfo.getParcelVersion(); + mConnectionId = in.readInt(); + mOverride = in.readInt() != 0; + mValue = in.readInt(); + mDirty = in.readInt() != 0; - // Pattern here is that all new members should be added to the end of - // the writeToParcel method. Then we step through each version, until the latest - // API release to help unravel this parcel - if (parcelableVersion >= Build.LINEAGE_VERSION_CODES.BOYSENBERRY) { - mConnectionId = in.readInt(); - mOverride = in.readInt() != 0; - mValue = in.readInt(); - mDirty = in.readInt() != 0; + if (mConnectionId == PROFILE_CONNECTION_2G3G4G) { + mSubId = in.readInt(); } - - if (parcelableVersion >= Build.LINEAGE_VERSION_CODES.ELDERBERRY) { - if (mConnectionId == PROFILE_CONNECTION_2G3G4G) { - mSubId = in.readInt(); - } - } - - // Complete parcel info for the concierge - parcelInfo.complete(); } private static final class OnStartTetheringCallback diff --git a/sdk/src/java/lineageos/profiles/LockSettings.java b/sdk/src/java/lineageos/profiles/LockSettings.java index ef3ee6ac..91a4a2e0 100644 --- a/sdk/src/java/lineageos/profiles/LockSettings.java +++ b/sdk/src/java/lineageos/profiles/LockSettings.java @@ -1,5 +1,6 @@ /* * SPDX-FileCopyrightText: 2015 The CyanogenMod Project + * SPDX-FileCopyrightText: 2025 The LineageOS Project * SPDX-License-Identifier: Apache-2.0 */ @@ -11,14 +12,10 @@ import android.os.Parcel; import android.os.Parcelable; import android.os.RemoteException; import android.util.Log; -/* import android.view.WindowManagerPolicyControl; */ + import com.android.internal.policy.IKeyguardService; -/* import com.android.internal.policy.PolicyManager; */ import lineageos.app.Profile; -import lineageos.os.Build; -import lineageos.os.Concierge; -import lineageos.os.Concierge.ParcelInfo; /** * The {@link LockSettings} class allows for overriding and setting the @@ -137,32 +134,13 @@ public final class LockSettings implements Parcelable { /** @hide */ @Override public void writeToParcel(Parcel dest, int flags) { - // Tell the concierge to prepare the parcel - ParcelInfo parcelInfo = Concierge.prepareParcel(dest); - - // === BOYSENBERRY === dest.writeInt(mValue); dest.writeInt(mDirty ? 1 : 0); - - // Complete the parcel info for the concierge - parcelInfo.complete(); } /** @hide */ public void readFromParcel(Parcel in) { - // Read parcelable version via the Concierge - ParcelInfo parcelInfo = Concierge.receiveParcel(in); - int parcelableVersion = parcelInfo.getParcelVersion(); - - // Pattern here is that all new members should be added to the end of - // the writeToParcel method. Then we step through each version, until the latest - // API release to help unravel this parcel - if (parcelableVersion >= Build.LINEAGE_VERSION_CODES.BOYSENBERRY) { - mValue = in.readInt(); - mDirty = in.readInt() != 0; - } - - // Complete parcel info for the concierge - parcelInfo.complete(); + mValue = in.readInt(); + mDirty = in.readInt() != 0; } } diff --git a/sdk/src/java/lineageos/profiles/RingModeSettings.java b/sdk/src/java/lineageos/profiles/RingModeSettings.java index ed3ad65a..7745a629 100644 --- a/sdk/src/java/lineageos/profiles/RingModeSettings.java +++ b/sdk/src/java/lineageos/profiles/RingModeSettings.java @@ -1,5 +1,6 @@ /* * SPDX-FileCopyrightText: 2015 The CyanogenMod Project + * SPDX-FileCopyrightText: 2025 The LineageOS Project * SPDX-License-Identifier: Apache-2.0 */ @@ -10,10 +11,6 @@ import android.media.AudioManager; import android.os.Parcel; import android.os.Parcelable; -import lineageos.os.Build; -import lineageos.os.Concierge; -import lineageos.os.Concierge.ParcelInfo; - import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; @@ -170,34 +167,15 @@ public final class RingModeSettings implements Parcelable { /** @hide */ @Override public void writeToParcel(Parcel dest, int flags) { - // Tell the concierge to prepare the parcel - ParcelInfo parcelInfo = Concierge.prepareParcel(dest); - - // === BOYSENBERRY === dest.writeInt(mOverride ? 1 : 0); dest.writeString(mValue); dest.writeInt(mDirty ? 1 : 0); - - // Complete the parcel info for the concierge - parcelInfo.complete(); } /** @hide */ public void readFromParcel(Parcel in) { - // Read parcelable version via the Concierge - ParcelInfo parcelInfo = Concierge.receiveParcel(in); - int parcelableVersion = parcelInfo.getParcelVersion(); - - // Pattern here is that all new members should be added to the end of - // the writeToParcel method. Then we step through each version, until the latest - // API release to help unravel this parcel - if (parcelableVersion >= Build.LINEAGE_VERSION_CODES.BOYSENBERRY) { - mOverride = in.readInt() != 0; - mValue = in.readString(); - mDirty = in.readInt() != 0; - } - - // Complete parcel info for the concierge - parcelInfo.complete(); + mOverride = in.readInt() != 0; + mValue = in.readString(); + mDirty = in.readInt() != 0; } } diff --git a/sdk/src/java/lineageos/profiles/StreamSettings.java b/sdk/src/java/lineageos/profiles/StreamSettings.java index 0d72cbb5..49d302a4 100644 --- a/sdk/src/java/lineageos/profiles/StreamSettings.java +++ b/sdk/src/java/lineageos/profiles/StreamSettings.java @@ -1,5 +1,6 @@ /* * SPDX-FileCopyrightText: 2015 The CyanogenMod Project + * SPDX-FileCopyrightText: 2025 The LineageOS Project * SPDX-License-Identifier: Apache-2.0 */ @@ -9,11 +10,6 @@ import android.content.Context; import android.os.Parcel; import android.os.Parcelable; - -import lineageos.os.Build; -import lineageos.os.Concierge; -import lineageos.os.Concierge.ParcelInfo; - import java.io.IOException; import org.xmlpull.v1.XmlPullParser; @@ -170,36 +166,17 @@ public final class StreamSettings implements Parcelable{ /** @hide */ @Override public void writeToParcel(Parcel dest, int flags) { - // Tell the concierge to prepare the parcel - ParcelInfo parcelInfo = Concierge.prepareParcel(dest); - - // === BOYSENBERRY === dest.writeInt(mStreamId); dest.writeInt(mOverride ? 1 : 0); dest.writeInt(mValue); dest.writeInt(mDirty ? 1 : 0); - - // Complete the parcel info for the concierge - parcelInfo.complete(); } /** @hide */ public void readFromParcel(Parcel in) { - // Read parcelable version via the Concierge - ParcelInfo parcelInfo = Concierge.receiveParcel(in); - int parcelableVersion = parcelInfo.getParcelVersion(); - - // Pattern here is that all new members should be added to the end of - // the writeToParcel method. Then we step through each version, until the latest - // API release to help unravel this parcel - if (parcelableVersion >= Build.LINEAGE_VERSION_CODES.BOYSENBERRY) { - mStreamId = in.readInt(); - mOverride = in.readInt() != 0; - mValue = in.readInt(); - mDirty = in.readInt() != 0; - } - - // Complete parcel info for the concierge - parcelInfo.complete(); + mStreamId = in.readInt(); + mOverride = in.readInt() != 0; + mValue = in.readInt(); + mDirty = in.readInt() != 0; } }