sdk: Cleanup PerformanceManager

* Remove per-app profiles support
* Remove cpu boost support

Change-Id: I37e7473f8df1d08a69bc9274ae356dc1133811db
This commit is contained in:
Luca Stefani
2018-02-08 16:41:17 +01:00
parent 18337dc1da
commit 38b21a6648
8 changed files with 19 additions and 247 deletions

View File

@@ -21,8 +21,6 @@ import lineageos.power.PerformanceProfile;
/** @hide */
interface IPerformanceManager {
oneway void cpuBoost(int duration);
boolean setPowerProfile(int profile);
int getPowerProfile();

View File

@@ -136,23 +136,6 @@ public class PerformanceManager {
return true;
}
/**
* Boost the CPU. Boosts the cpu for the given duration in microseconds.
* Requires the {@link android.Manifest.permission#CPU_BOOST} permission.
*
* @param duration in microseconds to boost the CPU
* @hide
*/
public void cpuBoost(int duration)
{
try {
if (checkService()) {
sService.cpuBoost(duration);
}
} catch (RemoteException e) {
}
}
/**
* Returns the number of supported profiles, -1 if unsupported
* This is queried via the PowerHAL.
@@ -259,24 +242,6 @@ public class PerformanceManager {
}
return ret;
}
/**
* Check if profile has app-specific profiles
*
* Returns true if profile has app-specific profiles.
*/
public boolean getProfileHasAppProfiles(int profile) {
boolean ret = false;
if (mNumberOfProfiles > 0) {
try {
if (checkService()) {
ret = sService.getPowerProfileById(profile).isBoostEnabled();
}
} catch (RemoteException e) {
// nothing
}
}
return ret;
}
/**
* Gets a set, sorted by weight, of all supported power profiles

View File

@@ -1,27 +0,0 @@
/*
* Copyright (C) 2015 The CyanogenMod Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package lineageos.power;
import android.content.Intent;
/** {@hide} */
public interface PerformanceManagerInternal {
void activityResumed(Intent intent);
void cpuBoost(int duration);
}

View File

@@ -37,15 +37,11 @@ public class PerformanceProfile implements Parcelable, Comparable<PerformancePro
private final String mDescription;
private final boolean mBoostEnabled;
public PerformanceProfile(int id, float weight, String name, String description,
boolean boostEnabled) {
public PerformanceProfile(int id, float weight, String name, String description) {
mId = id;
mWeight = weight;
mName = name;
mDescription = description;
mBoostEnabled = boostEnabled;
}
private PerformanceProfile(Parcel in) {
@@ -56,7 +52,6 @@ public class PerformanceProfile implements Parcelable, Comparable<PerformancePro
mWeight = in.readFloat();
mName = in.readString();
mDescription = in.readString();
mBoostEnabled = in.readInt() == 1;
if (parcelableVersion >= Build.LINEAGE_VERSION_CODES.GUAVA) {
// nothing yet
@@ -104,17 +99,6 @@ public class PerformanceProfile implements Parcelable, Comparable<PerformancePro
return mDescription;
}
/**
* Whether or not per-app profiles and boosting will be used when this
* profile is active. Far-end modes (powersave / high performance) do
* not use boosting.
*
* @return true if boosting and per-app optimization will be used
*/
public boolean isBoostEnabled() {
return mBoostEnabled;
}
@Override
public int describeContents() {
return 0;
@@ -128,7 +112,6 @@ public class PerformanceProfile implements Parcelable, Comparable<PerformancePro
dest.writeFloat(mWeight);
dest.writeString(mName);
dest.writeString(mDescription);
dest.writeInt(mBoostEnabled ? 1 : 0);
parcelInfo.complete();
}
@@ -170,7 +153,7 @@ public class PerformanceProfile implements Parcelable, Comparable<PerformancePro
@Override
public String toString() {
return String.format("PerformanceProfile[id=%d, weight=%f, name=%s desc=%s " +
"boostEnabled=%b]", mId, mWeight, mName, mDescription, mBoostEnabled);
return String.format("PerformanceProfile[id=%d, weight=%f, name=%s desc=%s]",
mId, mWeight, mName, mDescription);
}
}