Merge "resolve merge conflicts of fb54fde4023d1837cddf167ae6d503cb064060ad to master"
diff --git a/api/current.txt b/api/current.txt
index 9b910e8..014ba9d 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -29840,7 +29840,7 @@
method @Deprecated public boolean disableNetwork(int);
method @Deprecated public boolean disconnect();
method @Deprecated public boolean enableNetwork(int, boolean);
- method @Deprecated @RequiresPermission(allOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_WIFI_STATE}) public java.util.List<android.net.wifi.WifiConfiguration> getConfiguredNetworks();
+ method @Deprecated @RequiresPermission(allOf={android.Manifest.permission.ACCESS_FINE_LOCATION, android.Manifest.permission.ACCESS_WIFI_STATE}) public java.util.List<android.net.wifi.WifiConfiguration> getConfiguredNetworks();
method public android.net.wifi.WifiInfo getConnectionInfo();
method public android.net.DhcpInfo getDhcpInfo();
method public int getMaxNumberOfNetworkSuggestionsPerApp();
@@ -30331,26 +30331,26 @@
}
public class WifiP2pManager {
- method @RequiresPermission(android.Manifest.permission.ACCESS_COARSE_LOCATION) public void addLocalService(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.nsd.WifiP2pServiceInfo, android.net.wifi.p2p.WifiP2pManager.ActionListener);
+ method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public void addLocalService(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.nsd.WifiP2pServiceInfo, android.net.wifi.p2p.WifiP2pManager.ActionListener);
method public void addServiceRequest(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.nsd.WifiP2pServiceRequest, android.net.wifi.p2p.WifiP2pManager.ActionListener);
method public void cancelConnect(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.ActionListener);
method public void clearLocalServices(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.ActionListener);
method public void clearServiceRequests(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.ActionListener);
- method @RequiresPermission(android.Manifest.permission.ACCESS_COARSE_LOCATION) public void connect(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pConfig, android.net.wifi.p2p.WifiP2pManager.ActionListener);
- method @RequiresPermission(android.Manifest.permission.ACCESS_COARSE_LOCATION) public void createGroup(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.ActionListener);
- method @RequiresPermission(android.Manifest.permission.ACCESS_COARSE_LOCATION) public void createGroup(@NonNull android.net.wifi.p2p.WifiP2pManager.Channel, @Nullable android.net.wifi.p2p.WifiP2pConfig, @Nullable android.net.wifi.p2p.WifiP2pManager.ActionListener);
- method @RequiresPermission(android.Manifest.permission.ACCESS_COARSE_LOCATION) public void discoverPeers(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.ActionListener);
- method @RequiresPermission(android.Manifest.permission.ACCESS_COARSE_LOCATION) public void discoverServices(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.ActionListener);
+ method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public void connect(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pConfig, android.net.wifi.p2p.WifiP2pManager.ActionListener);
+ method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public void createGroup(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.ActionListener);
+ method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public void createGroup(@NonNull android.net.wifi.p2p.WifiP2pManager.Channel, @Nullable android.net.wifi.p2p.WifiP2pConfig, @Nullable android.net.wifi.p2p.WifiP2pManager.ActionListener);
+ method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public void discoverPeers(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.ActionListener);
+ method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public void discoverServices(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.ActionListener);
method public android.net.wifi.p2p.WifiP2pManager.Channel initialize(android.content.Context, android.os.Looper, android.net.wifi.p2p.WifiP2pManager.ChannelListener);
method public void removeGroup(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.ActionListener);
method public void removeLocalService(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.nsd.WifiP2pServiceInfo, android.net.wifi.p2p.WifiP2pManager.ActionListener);
method public void removeServiceRequest(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.nsd.WifiP2pServiceRequest, android.net.wifi.p2p.WifiP2pManager.ActionListener);
method public void requestConnectionInfo(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.ConnectionInfoListener);
method public void requestDiscoveryState(@NonNull android.net.wifi.p2p.WifiP2pManager.Channel, @NonNull android.net.wifi.p2p.WifiP2pManager.DiscoveryStateListener);
- method @RequiresPermission(android.Manifest.permission.ACCESS_COARSE_LOCATION) public void requestGroupInfo(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.GroupInfoListener);
+ method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public void requestGroupInfo(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.GroupInfoListener);
method public void requestNetworkInfo(@NonNull android.net.wifi.p2p.WifiP2pManager.Channel, @NonNull android.net.wifi.p2p.WifiP2pManager.NetworkInfoListener);
method public void requestP2pState(@NonNull android.net.wifi.p2p.WifiP2pManager.Channel, @NonNull android.net.wifi.p2p.WifiP2pManager.P2pStateListener);
- method @RequiresPermission(android.Manifest.permission.ACCESS_COARSE_LOCATION) public void requestPeers(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.PeerListListener);
+ method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public void requestPeers(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.PeerListListener);
method public void setDnsSdResponseListeners(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.DnsSdServiceResponseListener, android.net.wifi.p2p.WifiP2pManager.DnsSdTxtRecordListener);
method public void setServiceResponseListener(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.ServiceResponseListener);
method public void setUpnpServiceResponseListener(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.UpnpServiceResponseListener);
diff --git a/api/system-current.txt b/api/system-current.txt
index ffabbe2..8ead061 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -4659,7 +4659,7 @@
method @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD}) public java.util.List<android.util.Pair<android.net.wifi.WifiConfiguration,java.util.Map<java.lang.Integer,java.util.List<android.net.wifi.ScanResult>>>> getAllMatchingWifiConfigs(@NonNull java.util.List<android.net.wifi.ScanResult>);
method @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD}) public java.util.Map<android.net.wifi.hotspot2.OsuProvider,java.util.List<android.net.wifi.ScanResult>> getMatchingOsuProviders(java.util.List<android.net.wifi.ScanResult>);
method @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD}) public java.util.Map<android.net.wifi.hotspot2.OsuProvider,android.net.wifi.hotspot2.PasspointConfiguration> getMatchingPasspointConfigsForOsuProviders(@NonNull java.util.Set<android.net.wifi.hotspot2.OsuProvider>);
- method @RequiresPermission(allOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_WIFI_STATE, android.Manifest.permission.READ_WIFI_CREDENTIAL}) public java.util.List<android.net.wifi.WifiConfiguration> getPrivilegedConfiguredNetworks();
+ method @RequiresPermission(allOf={android.Manifest.permission.ACCESS_FINE_LOCATION, android.Manifest.permission.ACCESS_WIFI_STATE, android.Manifest.permission.READ_WIFI_CREDENTIAL}) public java.util.List<android.net.wifi.WifiConfiguration> getPrivilegedConfiguredNetworks();
method @RequiresPermission(android.Manifest.permission.ACCESS_WIFI_STATE) public android.net.wifi.WifiConfiguration getWifiApConfiguration();
method @RequiresPermission(android.Manifest.permission.ACCESS_WIFI_STATE) public int getWifiApState();
method public boolean isDeviceToDeviceRttSupported();
diff --git a/core/java/android/hardware/display/ColorDisplayManager.java b/core/java/android/hardware/display/ColorDisplayManager.java
index 28e9535..27f0b04 100644
--- a/core/java/android/hardware/display/ColorDisplayManager.java
+++ b/core/java/android/hardware/display/ColorDisplayManager.java
@@ -23,12 +23,14 @@
import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
import android.annotation.SystemService;
+import android.content.ContentResolver;
import android.content.Context;
import android.metrics.LogMaker;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.ServiceManager.ServiceNotFoundException;
+import android.provider.Settings.Secure;
import com.android.internal.R;
import com.android.internal.logging.MetricsLogger;
@@ -123,6 +125,42 @@
@SystemApi
public static final int AUTO_MODE_TWILIGHT = 2;
+ /**
+ * @hide
+ */
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef({COLOR_MODE_NATURAL, COLOR_MODE_BOOSTED, COLOR_MODE_SATURATED, COLOR_MODE_AUTOMATIC})
+ public @interface ColorMode {}
+
+ /**
+ * Color mode with natural colors.
+ *
+ * @hide
+ * @see #setColorMode(int)
+ */
+ public static final int COLOR_MODE_NATURAL = 0;
+ /**
+ * Color mode with boosted colors.
+ *
+ * @hide
+ * @see #setColorMode(int)
+ */
+ public static final int COLOR_MODE_BOOSTED = 1;
+ /**
+ * Color mode with saturated colors.
+ *
+ * @hide
+ * @see #setColorMode(int)
+ */
+ public static final int COLOR_MODE_SATURATED = 2;
+ /**
+ * Color mode with automatic colors.
+ *
+ * @hide
+ * @see #setColorMode(int)
+ */
+ public static final int COLOR_MODE_AUTOMATIC = 3;
+
private final ColorDisplayManagerInternal mManager;
private MetricsLogger mMetricsLogger;
@@ -286,6 +324,24 @@
}
/**
+ * Sets the current display color mode.
+ *
+ * @hide
+ */
+ public void setColorMode(int colorMode) {
+ mManager.setColorMode(colorMode);
+ }
+
+ /**
+ * Gets the current display color mode.
+ *
+ * @hide
+ */
+ public int getColorMode() {
+ return mManager.getColorMode();
+ }
+
+ /**
* Returns whether the device has a wide color gamut display.
*
* @hide
@@ -384,6 +440,18 @@
return mManager.getTransformCapabilities();
}
+ /**
+ * Returns whether accessibility transforms are currently enabled, which determines whether
+ * color modes are currently configurable for this device.
+ *
+ * @hide
+ */
+ public static boolean areAccessibilityTransformsEnabled(Context context) {
+ final ContentResolver cr = context.getContentResolver();
+ return Secure.getInt(cr, Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED, 0) == 1
+ || Secure.getInt(cr, Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED, 0) == 1;
+ }
+
private MetricsLogger getMetricsLogger() {
if (mMetricsLogger == null) {
mMetricsLogger = new MetricsLogger();
@@ -528,6 +596,22 @@
}
}
+ int getColorMode() {
+ try {
+ return mCdm.getColorMode();
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
+ void setColorMode(int colorMode) {
+ try {
+ mCdm.setColorMode(colorMode);
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
int getTransformCapabilities() {
try {
return mCdm.getTransformCapabilities();
diff --git a/core/java/android/hardware/display/IColorDisplayManager.aidl b/core/java/android/hardware/display/IColorDisplayManager.aidl
index 1918fd5..30e76cf 100644
--- a/core/java/android/hardware/display/IColorDisplayManager.aidl
+++ b/core/java/android/hardware/display/IColorDisplayManager.aidl
@@ -38,4 +38,7 @@
boolean setNightDisplayCustomStartTime(in Time time);
Time getNightDisplayCustomEndTime();
boolean setNightDisplayCustomEndTime(in Time time);
+
+ int getColorMode();
+ void setColorMode(int colorMode);
}
\ No newline at end of file
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index bd515c1..d840e3c 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -59,6 +59,7 @@
import android.content.res.Resources;
import android.database.Cursor;
import android.database.SQLException;
+import android.hardware.display.ColorDisplayManager;
import android.location.LocationManager;
import android.media.AudioFormat;
import android.net.ConnectivityManager;
@@ -89,7 +90,6 @@
import android.view.inputmethod.InputMethodSystemProperty;
import com.android.internal.annotations.GuardedBy;
-import com.android.internal.app.ColorDisplayController;
import com.android.internal.widget.ILockSettings;
import java.io.IOException;
@@ -3239,8 +3239,8 @@
private static final Validator DISPLAY_COLOR_MODE_VALIDATOR =
new SettingsValidators.InclusiveIntegerRangeValidator(
- ColorDisplayController.COLOR_MODE_NATURAL,
- ColorDisplayController.COLOR_MODE_AUTOMATIC);
+ ColorDisplayManager.COLOR_MODE_NATURAL,
+ ColorDisplayManager.COLOR_MODE_AUTOMATIC);
/**
* The amount of time in milliseconds before the device goes to sleep or begins
diff --git a/core/java/com/android/internal/app/ColorDisplayController.java b/core/java/com/android/internal/app/ColorDisplayController.java
index b03fde7..2ac0e4d 100644
--- a/core/java/com/android/internal/app/ColorDisplayController.java
+++ b/core/java/com/android/internal/app/ColorDisplayController.java
@@ -16,7 +16,6 @@
package com.android.internal.app;
-import android.annotation.IntDef;
import android.annotation.NonNull;
import android.app.ActivityManager;
import android.content.ContentResolver;
@@ -24,18 +23,13 @@
import android.database.ContentObserver;
import android.hardware.display.ColorDisplayManager;
import android.hardware.display.ColorDisplayManager.AutoMode;
+import android.hardware.display.ColorDisplayManager.ColorMode;
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
-import android.os.SystemProperties;
import android.provider.Settings.Secure;
-import android.provider.Settings.System;
import android.util.Slog;
-import com.android.internal.R;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
import java.time.LocalTime;
/**
@@ -49,35 +43,6 @@
private static final String TAG = "ColorDisplayController";
private static final boolean DEBUG = false;
- @Retention(RetentionPolicy.SOURCE)
- @IntDef({COLOR_MODE_NATURAL, COLOR_MODE_BOOSTED, COLOR_MODE_SATURATED, COLOR_MODE_AUTOMATIC})
- public @interface ColorMode {}
-
- /**
- * Color mode with natural colors.
- *
- * @see #setColorMode(int)
- */
- public static final int COLOR_MODE_NATURAL = 0;
- /**
- * Color mode with boosted colors.
- *
- * @see #setColorMode(int)
- */
- public static final int COLOR_MODE_BOOSTED = 1;
- /**
- * Color mode with saturated colors.
- *
- * @see #setColorMode(int)
- */
- public static final int COLOR_MODE_SATURATED = 2;
- /**
- * Color mode with automatic colors.
- *
- * @see #setColorMode(int)
- */
- public static final int COLOR_MODE_AUTOMATIC = 3;
-
private final Context mContext;
private final int mUserId;
private final ColorDisplayManager mColorDisplayManager;
@@ -197,74 +162,10 @@
}
/**
- * Get the current color mode from system properties, or return -1.
- *
- * See com.android.server.display.DisplayTransformManager.
- */
- private @ColorMode int getCurrentColorModeFromSystemProperties() {
- final int displayColorSetting = SystemProperties.getInt("persist.sys.sf.native_mode", 0);
- if (displayColorSetting == 0) {
- return "1.0".equals(SystemProperties.get("persist.sys.sf.color_saturation"))
- ? COLOR_MODE_NATURAL : COLOR_MODE_BOOSTED;
- } else if (displayColorSetting == 1) {
- return COLOR_MODE_SATURATED;
- } else if (displayColorSetting == 2) {
- return COLOR_MODE_AUTOMATIC;
- } else {
- return -1;
- }
- }
-
- private boolean isColorModeAvailable(@ColorMode int colorMode) {
- final int[] availableColorModes = mContext.getResources().getIntArray(
- R.array.config_availableColorModes);
- if (availableColorModes != null) {
- for (int mode : availableColorModes) {
- if (mode == colorMode) {
- return true;
- }
- }
- }
- return false;
- }
-
- /**
* Get the current color mode.
*/
public int getColorMode() {
- if (getAccessibilityTransformActivated()) {
- if (isColorModeAvailable(COLOR_MODE_SATURATED)) {
- return COLOR_MODE_SATURATED;
- } else if (isColorModeAvailable(COLOR_MODE_AUTOMATIC)) {
- return COLOR_MODE_AUTOMATIC;
- }
- }
-
- int colorMode = System.getIntForUser(mContext.getContentResolver(),
- System.DISPLAY_COLOR_MODE, -1, mUserId);
- if (colorMode == -1) {
- // There might be a system property controlling color mode that we need to respect; if
- // not, this will set a suitable default.
- colorMode = getCurrentColorModeFromSystemProperties();
- }
-
- // This happens when a color mode is no longer available (e.g., after system update or B&R)
- // or the device does not support any color mode.
- if (!isColorModeAvailable(colorMode)) {
- if (colorMode == COLOR_MODE_BOOSTED && isColorModeAvailable(COLOR_MODE_NATURAL)) {
- colorMode = COLOR_MODE_NATURAL;
- } else if (colorMode == COLOR_MODE_SATURATED
- && isColorModeAvailable(COLOR_MODE_AUTOMATIC)) {
- colorMode = COLOR_MODE_AUTOMATIC;
- } else if (colorMode == COLOR_MODE_AUTOMATIC
- && isColorModeAvailable(COLOR_MODE_SATURATED)) {
- colorMode = COLOR_MODE_SATURATED;
- } else {
- colorMode = -1;
- }
- }
-
- return colorMode;
+ return mColorDisplayManager.getColorMode();
}
/**
@@ -273,11 +174,7 @@
* @param colorMode the color mode
*/
public void setColorMode(@ColorMode int colorMode) {
- if (!isColorModeAvailable(colorMode)) {
- throw new IllegalArgumentException("Invalid colorMode: " + colorMode);
- }
- System.putIntForUser(mContext.getContentResolver(), System.DISPLAY_COLOR_MODE, colorMode,
- mUserId);
+ mColorDisplayManager.setColorMode(colorMode);
}
/**
@@ -294,18 +191,6 @@
return ColorDisplayManager.getMaximumColorTemperature(mContext);
}
- /**
- * Returns true if any Accessibility color transforms are enabled.
- */
- public boolean getAccessibilityTransformActivated() {
- final ContentResolver cr = mContext.getContentResolver();
- return
- Secure.getIntForUser(cr, Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED,
- 0, mUserId) == 1
- || Secure.getIntForUser(cr, Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED,
- 0, mUserId) == 1;
- }
-
private void onSettingChanged(@NonNull String setting) {
if (DEBUG) {
Slog.d(TAG, "onSettingChanged: " + setting);
@@ -328,13 +213,6 @@
case Secure.NIGHT_DISPLAY_COLOR_TEMPERATURE:
mCallback.onColorTemperatureChanged(getColorTemperature());
break;
- case System.DISPLAY_COLOR_MODE:
- mCallback.onDisplayColorModeChanged(getColorMode());
- break;
- case Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED:
- case Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED:
- mCallback.onAccessibilityTransformChanged(getAccessibilityTransformActivated());
- break;
}
}
}
@@ -377,14 +255,6 @@
false /* notifyForDescendants */, mContentObserver, mUserId);
cr.registerContentObserver(Secure.getUriFor(Secure.NIGHT_DISPLAY_COLOR_TEMPERATURE),
false /* notifyForDescendants */, mContentObserver, mUserId);
- cr.registerContentObserver(System.getUriFor(System.DISPLAY_COLOR_MODE),
- false /* notifyForDecendants */, mContentObserver, mUserId);
- cr.registerContentObserver(
- Secure.getUriFor(Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED),
- false /* notifyForDecendants */, mContentObserver, mUserId);
- cr.registerContentObserver(
- Secure.getUriFor(Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED),
- false /* notifyForDecendants */, mContentObserver, mUserId);
}
}
}
@@ -424,19 +294,5 @@
* @param colorTemperature the color temperature to tint the screen
*/
default void onColorTemperatureChanged(int colorTemperature) {}
-
- /**
- * Callback invoked when the color mode changes.
- *
- * @param displayColorMode the color mode
- */
- default void onDisplayColorModeChanged(int displayColorMode) {}
-
- /**
- * Callback invoked when Accessibility color transforms change.
- *
- * @param state the state Accessibility color transforms (true of active)
- */
- default void onAccessibilityTransformChanged(boolean state) {}
}
}
diff --git a/services/core/java/com/android/server/content/ContentService.java b/services/core/java/com/android/server/content/ContentService.java
index 5ed6263..e268e44 100644
--- a/services/core/java/com/android/server/content/ContentService.java
+++ b/services/core/java/com/android/server/content/ContentService.java
@@ -48,7 +48,6 @@
import android.os.Bundle;
import android.os.FactoryTest;
import android.os.IBinder;
-import android.os.Parcel;
import android.os.Process;
import android.os.RemoteException;
import android.os.ResultReceiver;
@@ -255,21 +254,6 @@
}
}
- @Override
- public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
- throws RemoteException {
- try {
- return super.onTransact(code, data, reply, flags);
- } catch (RuntimeException e) {
- // The content service only throws security exceptions, so let's
- // log all others.
- if (!(e instanceof SecurityException)) {
- Slog.wtf(TAG, "Content Service Crash", e);
- }
- throw e;
- }
- }
-
/*package*/ ContentService(Context context, boolean factoryTest) {
mContext = context;
mFactoryTest = factoryTest;
diff --git a/services/core/java/com/android/server/display/ColorDisplayService.java b/services/core/java/com/android/server/display/ColorDisplayService.java
index 58c88b3..eb0ed0a 100644
--- a/services/core/java/com/android/server/display/ColorDisplayService.java
+++ b/services/core/java/com/android/server/display/ColorDisplayService.java
@@ -19,7 +19,10 @@
import static android.hardware.display.ColorDisplayManager.AUTO_MODE_CUSTOM_TIME;
import static android.hardware.display.ColorDisplayManager.AUTO_MODE_DISABLED;
import static android.hardware.display.ColorDisplayManager.AUTO_MODE_TWILIGHT;
-
+import static android.hardware.display.ColorDisplayManager.COLOR_MODE_AUTOMATIC;
+import static android.hardware.display.ColorDisplayManager.COLOR_MODE_BOOSTED;
+import static android.hardware.display.ColorDisplayManager.COLOR_MODE_NATURAL;
+import static android.hardware.display.ColorDisplayManager.COLOR_MODE_SATURATED;
import static com.android.server.display.DisplayTransformManager.LEVEL_COLOR_MATRIX_DISPLAY_WHITE_BALANCE;
import static com.android.server.display.DisplayTransformManager.LEVEL_COLOR_MATRIX_NIGHT_DISPLAY;
import static com.android.server.display.DisplayTransformManager.LEVEL_COLOR_MATRIX_SATURATION;
@@ -45,6 +48,7 @@
import android.graphics.ColorSpace;
import android.hardware.display.ColorDisplayManager;
import android.hardware.display.ColorDisplayManager.AutoMode;
+import android.hardware.display.ColorDisplayManager.ColorMode;
import android.hardware.display.IColorDisplayManager;
import android.hardware.display.Time;
import android.net.Uri;
@@ -53,6 +57,7 @@
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
+import android.os.SystemProperties;
import android.os.UserHandle;
import android.provider.Settings.Secure;
import android.provider.Settings.System;
@@ -61,7 +66,6 @@
import android.view.SurfaceControl;
import android.view.accessibility.AccessibilityManager;
import android.view.animation.AnimationUtils;
-
import com.android.internal.R;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.app.ColorDisplayController;
@@ -71,7 +75,6 @@
import com.android.server.twilight.TwilightListener;
import com.android.server.twilight.TwilightManager;
import com.android.server.twilight.TwilightState;
-
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.lang.ref.WeakReference;
@@ -162,7 +165,7 @@
}
float[] displayRedGreenBlueXYZ =
- new float[NUM_DISPLAY_PRIMARIES_VALS - NUM_VALUES_PER_PRIMARY];
+ new float[NUM_DISPLAY_PRIMARIES_VALS - NUM_VALUES_PER_PRIMARY];
float[] displayWhiteXYZ = new float[NUM_VALUES_PER_PRIMARY];
for (int i = 0; i < displayRedGreenBlueXYZ.length; i++) {
displayRedGreenBlueXYZ[i] = Float.parseFloat(displayPrimariesValues[i]);
@@ -173,10 +176,10 @@
}
final ColorSpace.Rgb displayColorSpaceRGB = new ColorSpace.Rgb(
- "Display Color Space",
- displayRedGreenBlueXYZ,
- displayWhiteXYZ,
- 2.2f // gamma, unused for display white balance
+ "Display Color Space",
+ displayRedGreenBlueXYZ,
+ displayWhiteXYZ,
+ 2.2f // gamma, unused for display white balance
);
float[] displayNominalWhiteXYZ = new float[NUM_VALUES_PER_PRIMARY];
@@ -242,8 +245,8 @@
mCurrentColorTemperatureXYZ = ColorSpace.cctToIlluminantdXyz(cct);
mChromaticAdaptationMatrix =
- ColorSpace.chromaticAdaptation(ColorSpace.Adaptation.BRADFORD,
- mDisplayNominalWhiteXYZ, mCurrentColorTemperatureXYZ);
+ ColorSpace.chromaticAdaptation(ColorSpace.Adaptation.BRADFORD,
+ mDisplayNominalWhiteXYZ, mCurrentColorTemperatureXYZ);
// Convert the adaptation matrix to RGB space
float[] result = ColorSpace.mul3x3(mChromaticAdaptationMatrix,
@@ -385,7 +388,7 @@
* subtraction from 1. The last row represents a non-multiplied addition, see surfaceflinger's
* ProgramCache for full implementation details.
*/
- private static final float[] MATRIX_INVERT_COLOR = new float[] {
+ private static final float[] MATRIX_INVERT_COLOR = new float[]{
0.402f, -0.598f, -0.599f, 0f,
-1.174f, -0.174f, -1.175f, 0f,
-0.228f, -0.228f, 0.772f, 0f,
@@ -944,6 +947,89 @@
.setSaturationLevel(packageName, mCurrentUser, saturationLevel);
}
+ private void setColorModeInternal(@ColorMode int colorMode) {
+ if (!isColorModeAvailable(colorMode)) {
+ throw new IllegalArgumentException("Invalid colorMode: " + colorMode);
+ }
+ System.putIntForUser(getContext().getContentResolver(), System.DISPLAY_COLOR_MODE,
+ colorMode,
+ mCurrentUser);
+ }
+
+ private @ColorMode
+ int getColorModeInternal() {
+ final ContentResolver cr = getContext().getContentResolver();
+ if (Secure.getIntForUser(cr, Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED,
+ 0, mCurrentUser) == 1
+ || Secure.getIntForUser(cr, Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED,
+ 0, mCurrentUser) == 1) {
+ // There are restrictions on the available color modes combined with a11y transforms.
+ if (isColorModeAvailable(COLOR_MODE_SATURATED)) {
+ return COLOR_MODE_SATURATED;
+ } else if (isColorModeAvailable(COLOR_MODE_AUTOMATIC)) {
+ return COLOR_MODE_AUTOMATIC;
+ }
+ }
+
+ int colorMode = System.getIntForUser(cr, System.DISPLAY_COLOR_MODE, -1, mCurrentUser);
+ if (colorMode == -1) {
+ // There might be a system property controlling color mode that we need to respect; if
+ // not, this will set a suitable default.
+ colorMode = getCurrentColorModeFromSystemProperties();
+ }
+
+ // This happens when a color mode is no longer available (e.g., after system update or B&R)
+ // or the device does not support any color mode.
+ if (!isColorModeAvailable(colorMode)) {
+ if (colorMode == COLOR_MODE_BOOSTED && isColorModeAvailable(COLOR_MODE_NATURAL)) {
+ colorMode = COLOR_MODE_NATURAL;
+ } else if (colorMode == COLOR_MODE_SATURATED
+ && isColorModeAvailable(COLOR_MODE_AUTOMATIC)) {
+ colorMode = COLOR_MODE_AUTOMATIC;
+ } else if (colorMode == COLOR_MODE_AUTOMATIC
+ && isColorModeAvailable(COLOR_MODE_SATURATED)) {
+ colorMode = COLOR_MODE_SATURATED;
+ } else {
+ colorMode = -1;
+ }
+ }
+
+ return colorMode;
+ }
+
+ /**
+ * Get the current color mode from system properties, or return -1 if invalid.
+ *
+ * See {@link com.android.server.display.DisplayTransformManager}
+ */
+ private @ColorMode
+ int getCurrentColorModeFromSystemProperties() {
+ final int displayColorSetting = SystemProperties.getInt("persist.sys.sf.native_mode", 0);
+ if (displayColorSetting == 0) {
+ return "1.0".equals(SystemProperties.get("persist.sys.sf.color_saturation"))
+ ? COLOR_MODE_NATURAL : COLOR_MODE_BOOSTED;
+ } else if (displayColorSetting == 1) {
+ return COLOR_MODE_SATURATED;
+ } else if (displayColorSetting == 2) {
+ return COLOR_MODE_AUTOMATIC;
+ } else {
+ return -1;
+ }
+ }
+
+ private boolean isColorModeAvailable(@ColorMode int colorMode) {
+ final int[] availableColorModes = getContext().getResources().getIntArray(
+ R.array.config_availableColorModes);
+ if (availableColorModes != null) {
+ for (int mode : availableColorModes) {
+ if (mode == colorMode) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
private void dumpInternal(PrintWriter pw) {
pw.println("COLOR DISPLAY MANAGER dumpsys (color_display)");
pw.println("Night Display:");
@@ -1445,7 +1531,9 @@
*/
public interface ColorTransformController {
- /** Apply the given saturation (grayscale) matrix to the associated AppWindow. */
+ /**
+ * Apply the given saturation (grayscale) matrix to the associated AppWindow.
+ */
void applyAppSaturation(@Size(9) float[] matrix, @Size(3) float[] translation);
}
@@ -1453,6 +1541,29 @@
final class BinderService extends IColorDisplayManager.Stub {
@Override
+ public void setColorMode(int colorMode) {
+ getContext().enforceCallingOrSelfPermission(
+ Manifest.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS,
+ "Permission required to set display color mode");
+ final long token = Binder.clearCallingIdentity();
+ try {
+ setColorModeInternal(colorMode);
+ } finally {
+ Binder.restoreCallingIdentity(token);
+ }
+ }
+
+ @Override
+ public int getColorMode() {
+ final long token = Binder.clearCallingIdentity();
+ try {
+ return getColorModeInternal();
+ } finally {
+ Binder.restoreCallingIdentity(token);
+ }
+ }
+
+ @Override
public boolean isDeviceColorManaged() {
final long token = Binder.clearCallingIdentity();
try {
@@ -1640,7 +1751,9 @@
@Override
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
- if (!DumpUtils.checkDumpPermission(getContext(), TAG, pw)) return;
+ if (!DumpUtils.checkDumpPermission(getContext(), TAG, pw)) {
+ return;
+ }
final long token = Binder.clearCallingIdentity();
try {
diff --git a/services/core/java/com/android/server/display/DisplayTransformManager.java b/services/core/java/com/android/server/display/DisplayTransformManager.java
index a5e9728..b1b7d3c 100644
--- a/services/core/java/com/android/server/display/DisplayTransformManager.java
+++ b/services/core/java/com/android/server/display/DisplayTransformManager.java
@@ -17,6 +17,7 @@
package com.android.server.display;
import android.app.ActivityTaskManager;
+import android.hardware.display.ColorDisplayManager;
import android.opengl.Matrix;
import android.os.IBinder;
import android.os.Parcel;
@@ -27,7 +28,6 @@
import android.util.SparseArray;
import com.android.internal.annotations.GuardedBy;
-import com.android.internal.app.ColorDisplayController;
import java.util.Arrays;
@@ -248,20 +248,20 @@
* work in linear space.
*/
public static boolean needsLinearColorMatrix(int colorMode) {
- return colorMode != ColorDisplayController.COLOR_MODE_SATURATED;
+ return colorMode != ColorDisplayManager.COLOR_MODE_SATURATED;
}
public boolean setColorMode(int colorMode, float[] nightDisplayMatrix) {
- if (colorMode == ColorDisplayController.COLOR_MODE_NATURAL) {
+ if (colorMode == ColorDisplayManager.COLOR_MODE_NATURAL) {
applySaturation(COLOR_SATURATION_NATURAL);
setDisplayColor(DISPLAY_COLOR_MANAGED);
- } else if (colorMode == ColorDisplayController.COLOR_MODE_BOOSTED) {
+ } else if (colorMode == ColorDisplayManager.COLOR_MODE_BOOSTED) {
applySaturation(COLOR_SATURATION_BOOSTED);
setDisplayColor(DISPLAY_COLOR_MANAGED);
- } else if (colorMode == ColorDisplayController.COLOR_MODE_SATURATED) {
+ } else if (colorMode == ColorDisplayManager.COLOR_MODE_SATURATED) {
applySaturation(COLOR_SATURATION_NATURAL);
setDisplayColor(DISPLAY_COLOR_UNMANAGED);
- } else if (colorMode == ColorDisplayController.COLOR_MODE_AUTOMATIC) {
+ } else if (colorMode == ColorDisplayManager.COLOR_MODE_AUTOMATIC) {
applySaturation(COLOR_SATURATION_NATURAL);
setDisplayColor(DISPLAY_COLOR_ENHANCED);
}
diff --git a/services/tests/servicestests/src/com/android/server/display/ColorDisplayServiceTest.java b/services/tests/servicestests/src/com/android/server/display/ColorDisplayServiceTest.java
index ca39a7f..0b01657 100644
--- a/services/tests/servicestests/src/com/android/server/display/ColorDisplayServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/display/ColorDisplayServiceTest.java
@@ -918,15 +918,14 @@
}
setAccessibilityColorInversion(true);
- setColorMode(ColorDisplayController.COLOR_MODE_NATURAL);
+ setColorMode(ColorDisplayManager.COLOR_MODE_NATURAL);
startService();
- assertAccessibilityTransformActivated(true /* activated */ );
- assertUserColorMode(ColorDisplayController.COLOR_MODE_NATURAL);
- if (isColorModeValid(ColorDisplayController.COLOR_MODE_SATURATED)) {
- assertActiveColorMode(ColorDisplayController.COLOR_MODE_SATURATED);
- } else if (isColorModeValid(ColorDisplayController.COLOR_MODE_AUTOMATIC)) {
- assertActiveColorMode(ColorDisplayController.COLOR_MODE_AUTOMATIC);
+ assertUserColorMode(ColorDisplayManager.COLOR_MODE_NATURAL);
+ if (isColorModeValid(ColorDisplayManager.COLOR_MODE_SATURATED)) {
+ assertActiveColorMode(ColorDisplayManager.COLOR_MODE_SATURATED);
+ } else if (isColorModeValid(ColorDisplayManager.COLOR_MODE_AUTOMATIC)) {
+ assertActiveColorMode(ColorDisplayManager.COLOR_MODE_AUTOMATIC);
}
}
@@ -937,15 +936,14 @@
}
setAccessibilityColorCorrection(true);
- setColorMode(ColorDisplayController.COLOR_MODE_NATURAL);
+ setColorMode(ColorDisplayManager.COLOR_MODE_NATURAL);
startService();
- assertAccessibilityTransformActivated(true /* activated */ );
- assertUserColorMode(ColorDisplayController.COLOR_MODE_NATURAL);
- if (isColorModeValid(ColorDisplayController.COLOR_MODE_SATURATED)) {
- assertActiveColorMode(ColorDisplayController.COLOR_MODE_SATURATED);
- } else if (isColorModeValid(ColorDisplayController.COLOR_MODE_AUTOMATIC)) {
- assertActiveColorMode(ColorDisplayController.COLOR_MODE_AUTOMATIC);
+ assertUserColorMode(ColorDisplayManager.COLOR_MODE_NATURAL);
+ if (isColorModeValid(ColorDisplayManager.COLOR_MODE_SATURATED)) {
+ assertActiveColorMode(ColorDisplayManager.COLOR_MODE_SATURATED);
+ } else if (isColorModeValid(ColorDisplayManager.COLOR_MODE_AUTOMATIC)) {
+ assertActiveColorMode(ColorDisplayManager.COLOR_MODE_AUTOMATIC);
}
}
@@ -957,15 +955,14 @@
setAccessibilityColorCorrection(true);
setAccessibilityColorInversion(true);
- setColorMode(ColorDisplayController.COLOR_MODE_NATURAL);
+ setColorMode(ColorDisplayManager.COLOR_MODE_NATURAL);
startService();
- assertAccessibilityTransformActivated(true /* activated */ );
- assertUserColorMode(ColorDisplayController.COLOR_MODE_NATURAL);
- if (isColorModeValid(ColorDisplayController.COLOR_MODE_SATURATED)) {
- assertActiveColorMode(ColorDisplayController.COLOR_MODE_SATURATED);
- } else if (isColorModeValid(ColorDisplayController.COLOR_MODE_AUTOMATIC)) {
- assertActiveColorMode(ColorDisplayController.COLOR_MODE_AUTOMATIC);
+ assertUserColorMode(ColorDisplayManager.COLOR_MODE_NATURAL);
+ if (isColorModeValid(ColorDisplayManager.COLOR_MODE_SATURATED)) {
+ assertActiveColorMode(ColorDisplayManager.COLOR_MODE_SATURATED);
+ } else if (isColorModeValid(ColorDisplayManager.COLOR_MODE_AUTOMATIC)) {
+ assertActiveColorMode(ColorDisplayManager.COLOR_MODE_AUTOMATIC);
}
}
@@ -977,12 +974,11 @@
setAccessibilityColorCorrection(false);
setAccessibilityColorInversion(false);
- setColorMode(ColorDisplayController.COLOR_MODE_NATURAL);
+ setColorMode(ColorDisplayManager.COLOR_MODE_NATURAL);
startService();
- assertAccessibilityTransformActivated(false /* activated */ );
- assertUserColorMode(ColorDisplayController.COLOR_MODE_NATURAL);
- assertActiveColorMode(ColorDisplayController.COLOR_MODE_NATURAL);
+ assertUserColorMode(ColorDisplayManager.COLOR_MODE_NATURAL);
+ assertActiveColorMode(ColorDisplayManager.COLOR_MODE_NATURAL);
}
/**
@@ -1098,17 +1094,6 @@
}
/**
- * Convenience method for asserting that Accessibility color transform is detected.
- *
- * @param state {@code true} if any Accessibility transform should be activated
- */
- private void assertAccessibilityTransformActivated(boolean state) {
- assertWithMessage("Unexpected Accessibility color transform state")
- .that(mColorDisplayController.getAccessibilityTransformActivated())
- .isEqualTo(state);
- }
-
- /**
* Convenience method for asserting that the active color mode matches expectation.
*
* @param mode the expected active color mode.
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index 40077e1..8086039 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -16,7 +16,7 @@
package android.net.wifi;
-import static android.Manifest.permission.ACCESS_COARSE_LOCATION;
+import static android.Manifest.permission.ACCESS_FINE_LOCATION;
import static android.Manifest.permission.ACCESS_WIFI_STATE;
import static android.Manifest.permission.READ_WIFI_CREDENTIAL;
@@ -950,8 +950,7 @@
* which was created with {@link WifiNetworkConfigBuilder#setIsAppInteractionRequired()} flag
* set.
* <p>
- * Note: The broadcast is sent to the app only if it holds either one of
- * {@link android.Manifest.permission#ACCESS_COARSE_LOCATION ACCESS_COARSE_LOCATION} or
+ * Note: The broadcast is sent to the app only if it holds
* {@link android.Manifest.permission#ACCESS_FINE_LOCATION ACCESS_FINE_LOCATION} permission.
*
* @see #EXTRA_NETWORK_SUGGESTION
@@ -1183,7 +1182,7 @@
* containing configurations which they created.
*/
@Deprecated
- @RequiresPermission(allOf = {ACCESS_COARSE_LOCATION, ACCESS_WIFI_STATE})
+ @RequiresPermission(allOf = {ACCESS_FINE_LOCATION, ACCESS_WIFI_STATE})
public List<WifiConfiguration> getConfiguredNetworks() {
try {
ParceledListSlice<WifiConfiguration> parceledList =
@@ -1199,7 +1198,7 @@
/** @hide */
@SystemApi
- @RequiresPermission(allOf = {ACCESS_COARSE_LOCATION, ACCESS_WIFI_STATE, READ_WIFI_CREDENTIAL})
+ @RequiresPermission(allOf = {ACCESS_FINE_LOCATION, ACCESS_WIFI_STATE, READ_WIFI_CREDENTIAL})
public List<WifiConfiguration> getPrivilegedConfiguredNetworks() {
try {
ParceledListSlice<WifiConfiguration> parceledList =
@@ -1656,8 +1655,7 @@
* When the device decides to connect to one of the provided network suggestions, platform sends
* a directed broadcast {@link #ACTION_WIFI_NETWORK_SUGGESTION_POST_CONNECTION} to the app if
* the network was created with {@link WifiNetworkConfigBuilder#setIsAppInteractionRequired()}
- * flag set and the app holds either one of
- * {@link android.Manifest.permission#ACCESS_COARSE_LOCATION ACCESS_COARSE_LOCATION} or
+ * flag set and the app holds
* {@link android.Manifest.permission#ACCESS_FINE_LOCATION ACCESS_FINE_LOCATION} permission.
*<p>
* NOTE:
@@ -2290,7 +2288,6 @@
/**
* Return the results of the latest access point scan.
* @return the list of access points found in the most recent scan. An app must hold
- * {@link android.Manifest.permission#ACCESS_COARSE_LOCATION ACCESS_COARSE_LOCATION} or
* {@link android.Manifest.permission#ACCESS_FINE_LOCATION ACCESS_FINE_LOCATION} permission
* in order to get valid results.
*/
@@ -2601,7 +2598,7 @@
* <p>
* Applications need to have the following permissions to start LocalOnlyHotspot: {@link
* android.Manifest.permission#CHANGE_WIFI_STATE} and {@link
- * android.Manifest.permission#ACCESS_COARSE_LOCATION ACCESS_COARSE_LOCATION}. Callers without
+ * android.Manifest.permission#ACCESS_FINE_LOCATION ACCESS_FINE_LOCATION}. Callers without
* the permissions will trigger a {@link java.lang.SecurityException}.
* <p>
* @param callback LocalOnlyHotspotCallback for the application to receive updates about
@@ -2684,7 +2681,7 @@
* {@link LocalOnlyHotspotObserver#onStopped()} callbacks.
* <p>
* Applications should have the
- * {@link android.Manifest.permission#ACCESS_COARSE_LOCATION ACCESS_COARSE_LOCATION}
+ * {@link android.Manifest.permission#ACCESS_FINE_LOCATION ACCESS_FINE_LOCATION}
* permission. Callers without the permission will trigger a
* {@link java.lang.SecurityException}.
* <p>
diff --git a/wifi/java/android/net/wifi/aware/IdentityChangedListener.java b/wifi/java/android/net/wifi/aware/IdentityChangedListener.java
index 81a06e8..a8b19b3 100644
--- a/wifi/java/android/net/wifi/aware/IdentityChangedListener.java
+++ b/wifi/java/android/net/wifi/aware/IdentityChangedListener.java
@@ -30,7 +30,7 @@
public class IdentityChangedListener {
/**
* @param mac The MAC address of the Aware discovery interface. The application must have the
- * {@link android.Manifest.permission#ACCESS_COARSE_LOCATION} to get the actual MAC address,
+ * {@link android.Manifest.permission#ACCESS_FINE_LOCATION} to get the actual MAC address,
* otherwise all 0's will be provided.
*/
public void onIdentityChanged(byte[] mac) {
diff --git a/wifi/java/android/net/wifi/aware/WifiAwareManager.java b/wifi/java/android/net/wifi/aware/WifiAwareManager.java
index 1fa1fd5..8aef7a2 100644
--- a/wifi/java/android/net/wifi/aware/WifiAwareManager.java
+++ b/wifi/java/android/net/wifi/aware/WifiAwareManager.java
@@ -231,7 +231,7 @@
* <p>
* This version of the API attaches a listener to receive the MAC address of the Aware interface
* on startup and whenever it is updated (it is randomized at regular intervals for privacy).
- * The application must have the {@link android.Manifest.permission#ACCESS_COARSE_LOCATION}
+ * The application must have the {@link android.Manifest.permission#ACCESS_FINE_LOCATION}
* permission to execute this attach request. Otherwise, use the
* {@link #attach(AttachCallback, Handler)} version. Note that aside from permission
* requirements this listener will wake up the host at regular intervals causing higher power
diff --git a/wifi/java/android/net/wifi/aware/WifiAwareSession.java b/wifi/java/android/net/wifi/aware/WifiAwareSession.java
index 5f8841c..245b304 100644
--- a/wifi/java/android/net/wifi/aware/WifiAwareSession.java
+++ b/wifi/java/android/net/wifi/aware/WifiAwareSession.java
@@ -133,7 +133,7 @@
* An application must use the {@link DiscoverySession#close()} to
* terminate the publish discovery session once it isn't needed. This will free
* resources as well terminate any on-air transmissions.
- * <p>The application must have the {@link android.Manifest.permission#ACCESS_COARSE_LOCATION}
+ * <p>The application must have the {@link android.Manifest.permission#ACCESS_FINE_LOCATION}
* permission to start a publish discovery session.
*
* @param publishConfig The {@link PublishConfig} specifying the
@@ -179,7 +179,7 @@
* An application must use the {@link DiscoverySession#close()} to
* terminate the subscribe discovery session once it isn't needed. This will free
* resources as well terminate any on-air transmissions.
- * <p>The application must have the {@link android.Manifest.permission#ACCESS_COARSE_LOCATION}
+ * <p>The application must have the {@link android.Manifest.permission#ACCESS_FINE_LOCATION}
* permission to start a subscribe discovery session.
*
* @param subscribeConfig The {@link SubscribeConfig} specifying the
diff --git a/wifi/java/android/net/wifi/aware/package.html b/wifi/java/android/net/wifi/aware/package.html
index d5d962f6..c4f2e1f 100644
--- a/wifi/java/android/net/wifi/aware/package.html
+++ b/wifi/java/android/net/wifi/aware/package.html
@@ -15,7 +15,7 @@
<ul>
<li>{@link android.Manifest.permission#ACCESS_WIFI_STATE}</li>
<li>{@link android.Manifest.permission#CHANGE_WIFI_STATE}</li>
- <li>{@link android.Manifest.permission#ACCESS_COARSE_LOCATION}</li>
+ <li>{@link android.Manifest.permission#ACCESS_FINE_LOCATION}</li>
</ul>
<p class="note"><strong>Note:</strong> Not all Android-powered devices support Wi-Fi Aware
diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pManager.java b/wifi/java/android/net/wifi/p2p/WifiP2pManager.java
index 1bed914..052ab99 100644
--- a/wifi/java/android/net/wifi/p2p/WifiP2pManager.java
+++ b/wifi/java/android/net/wifi/p2p/WifiP2pManager.java
@@ -1139,7 +1139,7 @@
* @param c is the channel created at {@link #initialize}
* @param listener for callbacks on success or failure. Can be null.
*/
- @RequiresPermission(android.Manifest.permission.ACCESS_COARSE_LOCATION)
+ @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION)
public void discoverPeers(Channel c, ActionListener listener) {
checkChannel(c);
c.mAsyncChannel.sendMessage(DISCOVER_PEERS, 0, c.putListener(listener));
@@ -1183,7 +1183,7 @@
* @param config options as described in {@link WifiP2pConfig} class
* @param listener for callbacks on success or failure. Can be null.
*/
- @RequiresPermission(android.Manifest.permission.ACCESS_COARSE_LOCATION)
+ @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION)
public void connect(Channel c, WifiP2pConfig config, ActionListener listener) {
checkChannel(c);
checkP2pConfig(config);
@@ -1225,7 +1225,7 @@
* @param c is the channel created at {@link #initialize}
* @param listener for callbacks on success or failure. Can be null.
*/
- @RequiresPermission(android.Manifest.permission.ACCESS_COARSE_LOCATION)
+ @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION)
public void createGroup(Channel c, ActionListener listener) {
checkChannel(c);
c.mAsyncChannel.sendMessage(CREATE_GROUP, WifiP2pGroup.PERSISTENT_NET_ID,
@@ -1256,7 +1256,7 @@
* @param config the configuration of a p2p group.
* @param listener for callbacks on success or failure. Can be null.
*/
- @RequiresPermission(android.Manifest.permission.ACCESS_COARSE_LOCATION)
+ @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION)
public void createGroup(@NonNull Channel c,
@Nullable WifiP2pConfig config,
@Nullable ActionListener listener) {
@@ -1344,7 +1344,7 @@
* @param servInfo is a local service information.
* @param listener for callbacks on success or failure. Can be null.
*/
- @RequiresPermission(android.Manifest.permission.ACCESS_COARSE_LOCATION)
+ @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION)
public void addLocalService(Channel c, WifiP2pServiceInfo servInfo, ActionListener listener) {
checkChannel(c);
checkServiceInfo(servInfo);
@@ -1454,7 +1454,7 @@
* @param c is the channel created at {@link #initialize}
* @param listener for callbacks on success or failure. Can be null.
*/
- @RequiresPermission(android.Manifest.permission.ACCESS_COARSE_LOCATION)
+ @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION)
public void discoverServices(Channel c, ActionListener listener) {
checkChannel(c);
c.mAsyncChannel.sendMessage(DISCOVER_SERVICES, 0, c.putListener(listener));
@@ -1530,7 +1530,7 @@
* @param c is the channel created at {@link #initialize}
* @param listener for callback when peer list is available. Can be null.
*/
- @RequiresPermission(android.Manifest.permission.ACCESS_COARSE_LOCATION)
+ @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION)
public void requestPeers(Channel c, PeerListListener listener) {
checkChannel(c);
c.mAsyncChannel.sendMessage(REQUEST_PEERS, 0, c.putListener(listener));
@@ -1553,7 +1553,7 @@
* @param c is the channel created at {@link #initialize}
* @param listener for callback when group info is available. Can be null.
*/
- @RequiresPermission(android.Manifest.permission.ACCESS_COARSE_LOCATION)
+ @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION)
public void requestGroupInfo(Channel c, GroupInfoListener listener) {
checkChannel(c);
c.mAsyncChannel.sendMessage(REQUEST_GROUP_INFO, 0, c.putListener(listener));