Skip to content

Commit

Permalink
Merge remote-tracking branch 'public/r11.0' into r11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucchetto committed Nov 16, 2020
2 parents f66b42e + d1e2082 commit b5215bd
Show file tree
Hide file tree
Showing 72 changed files with 10,194 additions and 315 deletions.
1 change: 1 addition & 0 deletions Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ java_library {
"com.android.sysprop.apex",
"com.android.sysprop.init",
"PlatformProperties",
"vendor.lineage.livedisplay-V2.0-java",
],
sdk_version: "core_platform",
installable: false,
Expand Down
5 changes: 5 additions & 0 deletions core/java/android/app/IActivityManager.aidl
Original file line number Diff line number Diff line change
Expand Up @@ -683,4 +683,9 @@ interface IActivityManager {
* Kills uid with the reason of permission change.
*/
void killUidForPermissionChange(int appId, int userId, String reason);

/**
* Should disable touch if three fingers to screen shot is active?
*/
boolean isSwipeToScreenshotGestureActive();
}
74 changes: 74 additions & 0 deletions core/java/android/provider/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -4904,6 +4904,69 @@ public static void setShowGTalkServiceStatusForUser(ContentResolver cr, boolean
*/
public static final String LOCKSCREEN_BATTERY_INFO = "lockscreen_battery_info";

/**
* Color temperature of the display during the day
*/
public static final String DISPLAY_TEMPERATURE_DAY = "display_temperature_day";

/**
* Color temperature of the display at night
*/
public static final String DISPLAY_TEMPERATURE_NIGHT = "display_temperature_night";

/**
* Display color temperature adjustment mode, one of DAY (default), NIGHT, or AUTO.
*/
public static final String DISPLAY_TEMPERATURE_MODE = "display_temperature_mode";

/**
* Automatic outdoor mode
* 0 = 0ff, 1 = on
*/
public static final String DISPLAY_AUTO_OUTDOOR_MODE = "display_auto_outdoor_mode";

/**
* Reader mode
* 0 = 0ff, 1 = on
*/
public static final String DISPLAY_READING_MODE = "display_reading_mode";

/**
* Use display power saving features such as CABC or CABL
* 0 = 0ff, 1 = on
*/
public static final String DISPLAY_CABC = "display_low_power";

/**
* Use color enhancement feature of display
* 0 = 0ff, 1 = on
*/
public static final String DISPLAY_COLOR_ENHANCE = "display_color_enhance";

/**
* Use auto contrast optimization feature of display
* 0 = 0ff, 1 = on
*/
public static final String DISPLAY_AUTO_CONTRAST = "display_auto_contrast";

/**
* Manual display color adjustments (RGB values as floats, separated by spaces)
*/
public static final String DISPLAY_COLOR_ADJUSTMENT = "display_color_adjustment";

/**
* The current custom picture adjustment values as a delimited string
*/
public static final String DISPLAY_PICTURE_ADJUSTMENT =
"display_picture_adjustment";

/**
* Did we tell about how they can stop breaking their eyes?
* @hide
*/
public static final String LIVE_DISPLAY_HINTED = "live_display_hinted";


/**
* Keys we no longer back up under the current schema, but want to continue to
* process when restoring historical backup datasets.
Expand Down Expand Up @@ -5037,6 +5100,17 @@ public static void setShowGTalkServiceStatusForUser(ContentResolver cr, boolean
PRIVATE_SETTINGS.add(KEY_APP_SWITCH_LONG_PRESS_ACTION);
PRIVATE_SETTINGS.add(LOCKSCREEN_MEDIA_ART);
PRIVATE_SETTINGS.add(POCKET_JUDGE);
PRIVATE_SETTINGS.add(DISPLAY_TEMPERATURE_DAY);
PRIVATE_SETTINGS.add(DISPLAY_TEMPERATURE_NIGHT);
PRIVATE_SETTINGS.add(DISPLAY_TEMPERATURE_MODE);
PRIVATE_SETTINGS.add(DISPLAY_AUTO_OUTDOOR_MODE);
PRIVATE_SETTINGS.add(DISPLAY_READING_MODE);
PRIVATE_SETTINGS.add(DISPLAY_CABC);
PRIVATE_SETTINGS.add(DISPLAY_COLOR_ENHANCE);
PRIVATE_SETTINGS.add(DISPLAY_AUTO_CONTRAST);
PRIVATE_SETTINGS.add(DISPLAY_COLOR_ADJUSTMENT);
PRIVATE_SETTINGS.add(DISPLAY_PICTURE_ADJUSTMENT);
PRIVATE_SETTINGS.add(LIVE_DISPLAY_HINTED);
}

/**
Expand Down
14 changes: 14 additions & 0 deletions core/java/android/view/ViewRootImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -5996,6 +5996,11 @@ private int processKeyEvent(QueuedInputEvent q) {
private int processPointerEvent(QueuedInputEvent q) {
final MotionEvent event = (MotionEvent)q.mEvent;

if (event.getPointerCount() == 3 && isSwipeToScreenshotGestureActive()) {
event.setAction(MotionEvent.ACTION_CANCEL);
Log.d("teste", "canceling motionEvent because of threeGesture detecting");
}

mAttachInfo.mUnbufferedDispatchRequested = false;
mAttachInfo.mHandlingPointerEvent = true;
boolean handled = mView.dispatchPointerEvent(event);
Expand Down Expand Up @@ -9851,4 +9856,13 @@ boolean useBLAST() {
boolean isDrawingToBLASTTransaction() {
return mNextReportConsumeBLAST;
}

private boolean isSwipeToScreenshotGestureActive() {
try {
return ActivityManager.getService().isSwipeToScreenshotGestureActive();
} catch (RemoteException e) {
Log.e("teste", "isSwipeToScreenshotGestureActive exception", e);
return false;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/**
* 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 com.android.internal.custom.app;

import android.annotation.SdkConstant;

/**
* @hide
* TODO: We need to somehow make these managers accessible via getSystemService
*/
public final class LineageContextConstants {

/**
* @hide
*/
private LineageContextConstants() {
// Empty constructor
}

/**
* Use with {@link android.content.Context#getSystemService} to retrieve a
* {@link com.android.internal.custom.LineageHardwareManager} to manage the extended
* hardware features of the device.
*
* @see android.content.Context#getSystemService
* @see com.android.internal.custom.LineageHardwareManager
*
* @hide
*/
public static final String LINEAGE_HARDWARE_SERVICE = "lineagehardware";

/**
* Manages display color adjustments
*
* @hide
*/
public static final String LINEAGE_LIVEDISPLAY_SERVICE = "lineagelivedisplay";

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* Copyright (C) 2013 The CyanogenMod Project
* Copyright (C) 2018 The LineageOS 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 com.android.internal.custom.hardware;

import android.util.Log;

import com.android.internal.util.custom.FileUtils;

/**
* Adaptive backlight support (this refers to technologies like NVIDIA SmartDimmer,
* QCOM CABL or Samsung CABC).
*/
public class AdaptiveBacklight {

private static final String TAG = "AdaptiveBacklight";

private static final String FILE_CABC = "/sys/class/graphics/fb0/cabc";

/**
* Whether device supports an adaptive backlight technology.
*
* @return boolean Supported devices must return always true
*/
public static boolean isSupported() {
return FileUtils.isFileReadable(FILE_CABC) && FileUtils.isFileWritable(FILE_CABC);
}

/**
* This method return the current activation status of the adaptive backlight technology.
*
* @return boolean Must be false when adaptive backlight is not supported or not activated, or
* the operation failed while reading the status; true in any other case.
*/
public static boolean isEnabled() {
return Integer.parseInt(FileUtils.readOneLine(FILE_CABC)) > 0;
}

/**
* This method allows to setup adaptive backlight technology status.
*
* @param status The new adaptive backlight status
* @return boolean Must be false if adaptive backlight is not supported or the operation
* failed; true in any other case.
*/
public static boolean setEnabled(boolean status) {
return FileUtils.writeLine(FILE_CABC, status ? "1" : "0");
}
}
75 changes: 75 additions & 0 deletions core/java/com/android/internal/custom/hardware/AutoContrast.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* Copyright (C) 2014 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 com.android.internal.custom.hardware;

import com.android.internal.util.custom.FileUtils;

import android.util.Log;

/**
* Auto Contrast Optimization
*/
public class AutoContrast {

private static final String TAG = "AutoContrast";

private static final String FILE_ACO = "/sys/class/graphics/fb0/aco";

/**
* Whether device supports ACO
*
* @return boolean Supported devices must return always true
*/
public static boolean isSupported() {
return FileUtils.isFileReadable(FILE_ACO) && FileUtils.isFileWritable(FILE_ACO);
}

/**
* This method return the current activation status of ACO
*
* @return boolean Must be false when ACO is not supported or not activated, or
* the operation failed while reading the status; true in any other case.
*/
public static boolean isEnabled() {
try {
return Integer.parseInt(FileUtils.readOneLine(FILE_ACO)) > 0;
} catch (Exception e) {
Log.e(TAG, e.getMessage(), e);
}
return false;
}

/**
* This method allows to setup ACO
*
* @param status The new ACO status
* @return boolean Must be false if ACO is not supported or the operation
* failed; true in any other case.
*/
public static boolean setEnabled(boolean status) {
return FileUtils.writeLine(FILE_ACO, status ? "1" : "0");
}

/**
* Whether adaptive backlight (CABL / CABC) is required to be enabled
*
* @return boolean False if adaptive backlight is not a dependency
*/
public static boolean isAdaptiveBacklightRequired() {
return false;
}
}
Loading

0 comments on commit b5215bd

Please sign in to comment.