diff --git a/core/java/com/nvidia/NvCPLSvc/INvCPLRemoteService.aidl b/core/java/com/nvidia/NvCPLSvc/INvCPLRemoteService.aidl new file mode 100644 index 0000000000000000000000000000000000000000..65ce84b5de29194ee2756b5073553eb5274591e0 --- /dev/null +++ b/core/java/com/nvidia/NvCPLSvc/INvCPLRemoteService.aidl @@ -0,0 +1,27 @@ +package com.nvidia.NvCPLSvc; + +import android.content.Intent; +import java.util.List; + +import com.nvidia.NvCPLSvc.NvAppProfile; +import com.nvidia.NvCPLSvc.NvSaverAppInfo; + +/** @hide */ +interface INvCPLRemoteService { + IBinder getToolsApiInterface(String str); + String getAppProfileSettingString(String pkgName, int settingId); + int getAppProfileSettingInt(String pkgName, int settingId); + int getAppProfileSettingBoolean(String pkgName, int settingId); + byte[] getAppProfileSetting3DVStruct(String pkgName); + void handleIntent(in Intent intent); + boolean setNvSaverAppInfo(String pkgName, int list); + boolean setNvSaverAppInfoAll(in List<NvSaverAppInfo> appList); + List<NvSaverAppInfo> getNvSaverAppInfo(int i); + boolean setAppProfileSetting(String packageName, int typeId, int settingId, String value); + int getActiveProfileType(String packageName); + int[] getProfileTypes(String str); + boolean setActiveProfileType(String packageName, int typeId); + NvAppProfile[] getAppProfiles(in String[] strArr); + String getDeviceSerial(); + void powerHint(String str); +} diff --git a/core/java/com/nvidia/NvCPLSvc/NvAppProfile.aidl b/core/java/com/nvidia/NvCPLSvc/NvAppProfile.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a302010968a67c363ba643076ab9315be3a4afd0 --- /dev/null +++ b/core/java/com/nvidia/NvCPLSvc/NvAppProfile.aidl @@ -0,0 +1,2 @@ +package com.nvidia.NvCPLSvc; +parcelable NvAppProfile; diff --git a/core/java/com/nvidia/NvCPLSvc/NvAppProfile.java b/core/java/com/nvidia/NvCPLSvc/NvAppProfile.java new file mode 100644 index 0000000000000000000000000000000000000000..82986fbb7ca6a81fe61639f5ab03f2a05d302c7b --- /dev/null +++ b/core/java/com/nvidia/NvCPLSvc/NvAppProfile.java @@ -0,0 +1,65 @@ +package com.nvidia.NvCPLSvc; + +import android.net.ProxyInfo; +import android.os.Parcel; +import android.os.Parcelable; +import android.util.SparseArray; + +public class NvAppProfile implements Parcelable { + public static final Creator<NvAppProfile> CREATOR = new Creator<NvAppProfile>() { + public NvAppProfile createFromParcel(Parcel parcel) { + return NvAppProfile.createFromParcel(parcel); + } + + public NvAppProfile[] newArray(int size) { + return new NvAppProfile[size]; + } + }; + public final String pkgName; + public final String pkgVersion; + public final int typeId; + public SparseArray<String> settings; + + public NvAppProfile(int typeId, String pkgName, String pkgVersion, + SparseArray<String> settings) { + this.typeId = typeId; + this.pkgName = pkgName; + this.pkgVersion = pkgVersion; + this.settings = settings; + } + + private static NvAppProfile createFromParcel(Parcel parcel) { + int typeId = parcel.readInt(); + String pkgName = decodeNull(parcel.readString()); + String pkgVersion = decodeNull(parcel.readString()); + int numSettings = parcel.readInt(); + SparseArray<String> settings = new SparseArray(); + for (int i = 0; i < numSettings; i++) { + settings.append(parcel.readInt(), parcel.readString()); + } + return new NvAppProfile(typeId, pkgName, pkgVersion, settings); + } + + private static String encodeNull(String string) { + return string != null ? string : ProxyInfo.LOCAL_EXCL_LIST; + } + + private static String decodeNull(String string) { + return !string.equals(ProxyInfo.LOCAL_EXCL_LIST) ? string : null; + } + + public int describeContents() { + return 0; + } + + public void writeToParcel(Parcel parcel, int flag) { + parcel.writeInt(this.typeId); + parcel.writeString(encodeNull(this.pkgName)); + parcel.writeString(encodeNull(this.pkgVersion)); + parcel.writeInt(this.settings.size()); + for (int i = 0; i < this.settings.size(); i++) { + parcel.writeInt(this.settings.keyAt(i)); + parcel.writeString((String) this.settings.valueAt(i)); + } + } +} diff --git a/core/java/com/nvidia/NvCPLSvc/NvSaverAppInfo.aidl b/core/java/com/nvidia/NvCPLSvc/NvSaverAppInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ed0dd7d692c7fa1e266f6b5b9e652b0d3293e64e --- /dev/null +++ b/core/java/com/nvidia/NvCPLSvc/NvSaverAppInfo.aidl @@ -0,0 +1,2 @@ +package com.nvidia.NvCPLSvc; +parcelable NvSaverAppInfo; diff --git a/core/java/com/nvidia/NvCPLSvc/NvSaverAppInfo.java b/core/java/com/nvidia/NvCPLSvc/NvSaverAppInfo.java new file mode 100644 index 0000000000000000000000000000000000000000..76f1f05d618fb76509f7c3e46fb3d309af8aa5dc --- /dev/null +++ b/core/java/com/nvidia/NvCPLSvc/NvSaverAppInfo.java @@ -0,0 +1,166 @@ +package com.nvidia.NvCPLSvc; + +import android.graphics.drawable.Drawable; +import android.os.Parcel; +import android.os.Parcelable; + +public class NvSaverAppInfo implements Parcelable { + public static final Creator<NvSaverAppInfo> CREATOR = new Creator<NvSaverAppInfo>() { + public NvSaverAppInfo createFromParcel(Parcel source) { + return new NvSaverAppInfo(source); + } + + public NvSaverAppInfo[] newArray(int size) { + return new NvSaverAppInfo[size]; + } + }; + + public static final int NVSAVER_ACTIVITY_HIGH = 1; + public static final int NVSAVER_ACTIVITY_LOW = 3; + public static final int NVSAVER_ACTIVITY_MIDIUM = 2; + public static final int NVSAVER_LIST_BLACKLIST = 3; + public static final int NVSAVER_LIST_NONE = 1; + public static final int NVSAVER_LIST_WHITELIST = 2; + public static final int NV_APP_OPTIMIZE_LIST = 4; + public int mAppList; + public String mPkgName; + public long mTotalWakeupStatsTime; + public int mUid; + public long mWakeupStatsTime; + public int mWakeupTimes; + public int mWowWakeupTimes; + private int mAppActivity; + private Drawable mAppIcon; + private String mAppLabel; + private float mPowerSaver; + + public NvSaverAppInfo(Parcel pl) { + mUid = pl.readInt(); + mAppList = pl.readInt(); + mWakeupTimes = pl.readInt(); + mWowWakeupTimes = pl.readInt(); + mPkgName = pl.readString(); + mWakeupStatsTime = pl.readLong(); + mTotalWakeupStatsTime = pl.readLong(); + mAppLabel = null; + mAppIcon = null; + mAppActivity = 0; + mPowerSaver = 0.0f; + } + + public NvSaverAppInfo(int u, int a, int w, int wow, String pkg, long t1, long t2) { + mUid = u; + mAppList = a; + mWakeupTimes = w; + mWowWakeupTimes = wow; + mPkgName = pkg; + mWakeupStatsTime = t1; + mTotalWakeupStatsTime = t2; + mAppLabel = null; + mAppIcon = null; + mAppActivity = 0; + mPowerSaver = 0.0f; + } + + public String getAppLabel() { + return mAppLabel; + } + + public void setAppLabel(String appLabel) { + mAppLabel = appLabel; + } + + public Drawable getAppIcon() { + return mAppIcon; + } + + public void setAppIcon(Drawable appIcon) { + mAppIcon = appIcon; + } + + public int getAppActivity() { + return mAppActivity; + } + + public void setAppActivity(int activity) { + mAppActivity = activity; + } + + public String getPkgName() { + return mPkgName; + } + + public void setPkgName(String pkgName) { + mPkgName = pkgName; + } + + public int getUid() { + return mUid; + } + + public void setUid(int uid) { + mUid = uid; + } + + public int getWakeupTimes() { + return mWakeupTimes; + } + + public void setWakeupTimes(int wakeupTimes) { + mWakeupTimes = wakeupTimes; + } + + public int getWowWakeupTimes() { + return mWowWakeupTimes; + } + + public void setWowWakeupTimes(int wowWakeupTimes) { + mWowWakeupTimes = wowWakeupTimes; + } + + public long getTotalWakeupStatsTime() { + return mTotalWakeupStatsTime; + } + + public void setTotalWakeupStatsTime(long totalWakeupStatsTime) { + mTotalWakeupStatsTime = totalWakeupStatsTime; + } + + public long getWakeupStatsTime() { + return mWakeupStatsTime; + } + + public void setWakeupStatsTime(long wakeupStatsTime) { + mWakeupStatsTime = wakeupStatsTime; + } + + public int getAppList() { + return mAppList; + } + + public void setAppList(int appList) { + mAppList = appList; + } + + public float getPowerSaver() { + return mPowerSaver; + } + + public void setPowerSaver(float powerSaver) { + mPowerSaver = powerSaver; + } + + public int describeContents() { + return 0; + } + + public void writeToParcel(Parcel dest, int flags) { + dest.writeInt(mUid); + dest.writeInt(mAppList); + dest.writeInt(mWakeupTimes); + dest.writeInt(mWowWakeupTimes); + dest.writeString(mPkgName); + dest.writeLong(mWakeupStatsTime); + dest.writeLong(mTotalWakeupStatsTime); + } +}