Skip to content

Commit

Permalink
[droidmedia] Add fake sensor_privacy service
Browse files Browse the repository at this point in the history
  • Loading branch information
mlehtima committed Jan 18, 2021
1 parent 69a3353 commit 9ed5588
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
13 changes: 11 additions & 2 deletions Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ endif

ifeq ($(shell test $(ANDROID_MAJOR) -ge 10 && echo true),true)
LOCAL_SHARED_LIBRARIES += [email protected] \
[email protected]
[email protected] \
libsensorprivacy
LOCAL_AIDL_INCLUDES := frameworks/native/libs/sensorprivacy/aidl
endif

ifeq ($(shell test $(ANDROID_MAJOR) -ge 8 && echo true),true)
Expand Down Expand Up @@ -207,6 +209,11 @@ ifeq ($(ANDROID_MAJOR),$(filter $(ANDROID_MAJOR),9))
LOCAL_SHARED_LIBRARIES += [email protected]
endif

ifeq ($(shell test $(ANDROID_MAJOR) -ge 10 && echo true),true)
LOCAL_SHARED_LIBRARIES += libsensorprivacy
LOCAL_AIDL_INCLUDES := frameworks/native/libs/sensorprivacy/aidl
endif

LOCAL_MODULE_TAGS := optional
LOCAL_CPPFLAGS := -DANDROID_MAJOR=$(ANDROID_MAJOR) -DANDROID_MINOR=$(ANDROID_MINOR) -DANDROID_MICRO=$(ANDROID_MICRO) -Wno-unused-parameter
ifneq ($(CM_BUILD),)
Expand Down Expand Up @@ -243,7 +250,9 @@ endif

ifeq ($(shell test $(ANDROID_MAJOR) -ge 10 && echo true),true)
LOCAL_SHARED_LIBRARIES += [email protected] \
[email protected]
[email protected] \
libsensorprivacy
LOCAL_AIDL_INCLUDES := frameworks/native/libs/sensorprivacy/aidl
endif

ifeq ($(shell test $(ANDROID_MAJOR) -ge 8 && echo true),true)
Expand Down
3 changes: 3 additions & 0 deletions minimedia.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ main(int, char**)
FakePermissionController::instantiate();
FakeAppOps::instantiate();
FakeBatteryStats::instantiate();
#if ANDROID_MAJOR >= 10
FakeSensorPrivacyManager::instantiate();
#endif
#if !defined(SENSORSERVER_DISABLE) && ANDROID_MAJOR <= 9
FakeSensorServer::instantiate();
#endif
Expand Down
28 changes: 28 additions & 0 deletions services/services_10_0_0.h
Original file line number Diff line number Diff line change
Expand Up @@ -536,3 +536,31 @@ class FakeActivityManager : public BinderService<FakeActivityManager>,
return 0;
}
};

#include <android/hardware/BnSensorPrivacyManager.h>

class FakeSensorPrivacyManager : public BinderService<FakeSensorPrivacyManager>,
public hardware::BnSensorPrivacyManager
{
public:
static char const *getServiceName() {
return "sensor_privacy";
}

::android::binder::Status addSensorPrivacyListener(const sp<hardware::ISensorPrivacyListener>& listener) {
return ::android::binder::Status::ok();
}

::android::binder::Status removeSensorPrivacyListener(const sp<hardware::ISensorPrivacyListener>& listener) {
return ::android::binder::Status::ok();
}

::android::binder::Status isSensorPrivacyEnabled(bool *enabled) {
*enabled = false;
return ::android::binder::Status::ok();
}

::android::binder::Status setSensorPrivacy(bool enable) {
return ::android::binder::Status::ok();
}
};

0 comments on commit 9ed5588

Please sign in to comment.