Merge "Add @TestApi to brightness @SystemApis"
This commit is contained in:
committed by
Android (Google) Code Review
commit
3515a7bee4
@@ -580,6 +580,8 @@ package android.hardware.display {
|
||||
|
||||
public final class BrightnessConfiguration implements android.os.Parcelable {
|
||||
method public int describeContents();
|
||||
method public android.hardware.display.BrightnessCorrection getCorrectionByCategory(int);
|
||||
method public android.hardware.display.BrightnessCorrection getCorrectionByPackageName(java.lang.String);
|
||||
method public android.util.Pair<float[], float[]> getCurve();
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator<android.hardware.display.BrightnessConfiguration> CREATOR;
|
||||
@@ -587,10 +589,22 @@ package android.hardware.display {
|
||||
|
||||
public static class BrightnessConfiguration.Builder {
|
||||
ctor public BrightnessConfiguration.Builder(float[], float[]);
|
||||
method public android.hardware.display.BrightnessConfiguration.Builder addCorrectionByCategory(int, android.hardware.display.BrightnessCorrection);
|
||||
method public android.hardware.display.BrightnessConfiguration.Builder addCorrectionByPackageName(java.lang.String, android.hardware.display.BrightnessCorrection);
|
||||
method public android.hardware.display.BrightnessConfiguration build();
|
||||
method public int getMaxCorrectionsByCategory();
|
||||
method public int getMaxCorrectionsByPackageName();
|
||||
method public android.hardware.display.BrightnessConfiguration.Builder setDescription(java.lang.String);
|
||||
}
|
||||
|
||||
public final class BrightnessCorrection implements android.os.Parcelable {
|
||||
method public float apply(float);
|
||||
method public static android.hardware.display.BrightnessCorrection createScaleAndTranslateLog(float, float);
|
||||
method public int describeContents();
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator<android.hardware.display.BrightnessCorrection> CREATOR;
|
||||
}
|
||||
|
||||
public final class DisplayManager {
|
||||
method public java.util.List<android.hardware.display.AmbientBrightnessDayStats> getAmbientBrightnessStats();
|
||||
method public android.hardware.display.BrightnessConfiguration getBrightnessConfiguration();
|
||||
|
||||
@@ -91,9 +91,7 @@ public final class BrightnessConfiguration implements Parcelable {
|
||||
*
|
||||
* @return The matching brightness correction, or null.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@Nullable
|
||||
public BrightnessCorrection getCorrectionByPackageName(String packageName) {
|
||||
return mCorrectionsByPackageName.get(packageName);
|
||||
@@ -106,10 +104,7 @@ public final class BrightnessConfiguration implements Parcelable {
|
||||
* The app category.
|
||||
*
|
||||
* @return The matching brightness correction, or null.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@Nullable
|
||||
public BrightnessCorrection getCorrectionByCategory(int category) {
|
||||
return mCorrectionsByCategory.get(category);
|
||||
@@ -416,9 +411,7 @@ public final class BrightnessConfiguration implements Parcelable {
|
||||
*
|
||||
* @return The maximum number of corrections by package name allowed.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public int getMaxCorrectionsByPackageName() {
|
||||
return MAX_CORRECTIONS_BY_PACKAGE_NAME;
|
||||
}
|
||||
@@ -428,9 +421,7 @@ public final class BrightnessConfiguration implements Parcelable {
|
||||
*
|
||||
* @return The maximum number of corrections by category allowed.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public int getMaxCorrectionsByCategory() {
|
||||
return MAX_CORRECTIONS_BY_CATEGORY;
|
||||
}
|
||||
@@ -451,9 +442,7 @@ public final class BrightnessConfiguration implements Parcelable {
|
||||
* Maximum number of corrections by package name exceeded (see
|
||||
* {@link #getMaxCorrectionsByPackageName}).
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public Builder addCorrectionByPackageName(String packageName,
|
||||
BrightnessCorrection correction) {
|
||||
if (mCorrectionsByPackageName.size() >= getMaxCorrectionsByPackageName()) {
|
||||
@@ -479,9 +468,7 @@ public final class BrightnessConfiguration implements Parcelable {
|
||||
* Maximum number of corrections by category exceeded (see
|
||||
* {@link #getMaxCorrectionsByCategory}).
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public Builder addCorrectionByCategory(@ApplicationInfo.Category int category,
|
||||
BrightnessCorrection correction) {
|
||||
if (mCorrectionsByCategory.size() >= getMaxCorrectionsByCategory()) {
|
||||
@@ -504,8 +491,6 @@ public final class BrightnessConfiguration implements Parcelable {
|
||||
|
||||
/**
|
||||
* Builds the {@link BrightnessConfiguration}.
|
||||
*
|
||||
* A brightness curve <b>must</b> be set before calling this.
|
||||
*/
|
||||
public BrightnessConfiguration build() {
|
||||
if (mCurveLux == null || mCurveNits == null) {
|
||||
|
||||
@@ -18,6 +18,7 @@ package android.hardware.display;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.SystemApi;
|
||||
import android.annotation.TestApi;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.util.MathUtils;
|
||||
@@ -41,6 +42,7 @@ import java.io.IOException;
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@TestApi
|
||||
public final class BrightnessCorrection implements Parcelable {
|
||||
|
||||
private static final int SCALE_AND_TRANSLATE_LOG = 1;
|
||||
@@ -98,6 +100,24 @@ public final class BrightnessCorrection implements Parcelable {
|
||||
return mImplementation.toString();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (o == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof BrightnessCorrection)) {
|
||||
return false;
|
||||
}
|
||||
BrightnessCorrection other = (BrightnessCorrection) o;
|
||||
return other.mImplementation.equals(mImplementation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return mImplementation.hashCode();
|
||||
}
|
||||
|
||||
public static final Creator<BrightnessCorrection> CREATOR =
|
||||
new Creator<BrightnessCorrection>() {
|
||||
public BrightnessCorrection createFromParcel(Parcel in) {
|
||||
@@ -214,6 +234,26 @@ public final class BrightnessCorrection implements Parcelable {
|
||||
return "ScaleAndTranslateLog(" + mScale + ", " + mTranslate + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (o == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof ScaleAndTranslateLog)) {
|
||||
return false;
|
||||
}
|
||||
ScaleAndTranslateLog other = (ScaleAndTranslateLog) o;
|
||||
return other.mScale == mScale && other.mTranslate == mTranslate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = 1;
|
||||
result = result * 31 + Float.hashCode(mScale);
|
||||
result = result * 31 + Float.hashCode(mTranslate);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest) {
|
||||
dest.writeInt(SCALE_AND_TRANSLATE_LOG);
|
||||
|
||||
Reference in New Issue
Block a user