Merge "Simplify Context Hub global setting update"
This commit is contained in:
committed by
Android (Google) Code Review
commit
6687929473
@@ -293,7 +293,7 @@ public class ContextHubService extends IContextHubService.Stub {
|
||||
}, UserHandle.USER_ALL);
|
||||
}
|
||||
|
||||
if (mContextHubWrapper.supportsMicrophoneDisableSettingNotifications()) {
|
||||
if (mContextHubWrapper.supportsMicrophoneSettingNotifications()) {
|
||||
sendMicrophoneDisableSettingUpdateForCurrentUser();
|
||||
|
||||
mSensorPrivacyManagerInternal.addSensorPrivacyListenerForAllUsers(
|
||||
@@ -1100,7 +1100,10 @@ public class ContextHubService extends IContextHubService.Stub {
|
||||
*/
|
||||
private void sendMicrophoneDisableSettingUpdate(boolean enabled) {
|
||||
Log.d(TAG, "Mic Disabled Setting: " + enabled);
|
||||
mContextHubWrapper.onMicrophoneDisableSettingChanged(enabled);
|
||||
// The SensorPrivacyManager reports if microphone privacy was enabled,
|
||||
// which translates to microphone access being disabled (and vice-versa).
|
||||
// With this in mind, we flip the argument before piping it to CHRE.
|
||||
mContextHubWrapper.onMicrophoneSettingChanged(!enabled);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -228,15 +228,15 @@ public abstract class IContextHubWrapper {
|
||||
public abstract void onAirplaneModeSettingChanged(boolean enabled);
|
||||
|
||||
/**
|
||||
* @return True if this version of the Contexthub HAL supports microphone disable setting
|
||||
* @return True if this version of the Contexthub HAL supports microphone setting
|
||||
* notifications.
|
||||
*/
|
||||
public abstract boolean supportsMicrophoneDisableSettingNotifications();
|
||||
public abstract boolean supportsMicrophoneSettingNotifications();
|
||||
|
||||
/**
|
||||
* Notifies the Contexthub implementation of a microphone disable setting change.
|
||||
* Notifies the Contexthub implementation of a microphone setting change.
|
||||
*/
|
||||
public abstract void onMicrophoneDisableSettingChanged(boolean enabled);
|
||||
public abstract void onMicrophoneSettingChanged(boolean enabled);
|
||||
|
||||
/**
|
||||
* Sends a message to the Context Hub.
|
||||
@@ -380,7 +380,7 @@ public abstract class IContextHubWrapper {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean supportsMicrophoneDisableSettingNotifications() {
|
||||
public boolean supportsMicrophoneSettingNotifications() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -395,7 +395,7 @@ public abstract class IContextHubWrapper {
|
||||
onSettingChanged(android.hardware.contexthub.Setting.AIRPLANE_MODE, enabled);
|
||||
}
|
||||
|
||||
public void onMicrophoneDisableSettingChanged(boolean enabled) {
|
||||
public void onMicrophoneSettingChanged(boolean enabled) {
|
||||
onSettingChanged(android.hardware.contexthub.Setting.MICROPHONE, enabled);
|
||||
}
|
||||
|
||||
@@ -615,7 +615,7 @@ public abstract class IContextHubWrapper {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean supportsMicrophoneDisableSettingNotifications() {
|
||||
public boolean supportsMicrophoneSettingNotifications() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -628,7 +628,7 @@ public abstract class IContextHubWrapper {
|
||||
public void onAirplaneModeSettingChanged(boolean enabled) {
|
||||
}
|
||||
|
||||
public void onMicrophoneDisableSettingChanged(boolean enabled) {
|
||||
public void onMicrophoneSettingChanged(boolean enabled) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -660,7 +660,7 @@ public abstract class IContextHubWrapper {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean supportsMicrophoneDisableSettingNotifications() {
|
||||
public boolean supportsMicrophoneSettingNotifications() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -679,7 +679,7 @@ public abstract class IContextHubWrapper {
|
||||
public void onAirplaneModeSettingChanged(boolean enabled) {
|
||||
}
|
||||
|
||||
public void onMicrophoneDisableSettingChanged(boolean enabled) {
|
||||
public void onMicrophoneSettingChanged(boolean enabled) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -721,7 +721,7 @@ public abstract class IContextHubWrapper {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean supportsMicrophoneDisableSettingNotifications() {
|
||||
public boolean supportsMicrophoneSettingNotifications() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -740,12 +740,9 @@ public abstract class IContextHubWrapper {
|
||||
enabled ? SettingValue.ENABLED : SettingValue.DISABLED);
|
||||
}
|
||||
|
||||
public void onMicrophoneDisableSettingChanged(boolean enabled) {
|
||||
// The SensorPrivacyManager reports if microphone privacy was enabled,
|
||||
// which translates to microphone access being disabled (and vice-versa).
|
||||
// With this in mind, we flip the argument before piping it to CHRE.
|
||||
public void onMicrophoneSettingChanged(boolean enabled) {
|
||||
sendSettingChanged(android.hardware.contexthub.V1_2.Setting.MICROPHONE,
|
||||
enabled ? SettingValue.DISABLED : SettingValue.ENABLED);
|
||||
enabled ? SettingValue.ENABLED : SettingValue.DISABLED);
|
||||
}
|
||||
|
||||
public void registerCallback(int contextHubId, ICallback callback) throws RemoteException {
|
||||
|
||||
Reference in New Issue
Block a user