Skip to content

Commit

Permalink
[droidmedia] Disable/remove FakeSensor support for Android 10
Browse files Browse the repository at this point in the history
Stagefrights ALooper and the baseline ALooper used by Android conflict
so remove FakeSensor support for Android 10 (error: reference to
'ALooper' is ambiguous) as suggested by @abranson.
  • Loading branch information
Thaodan authored and mlehtima committed Jan 18, 2021
1 parent 0b8aaa4 commit 69a3353
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 125 deletions.
5 changes: 2 additions & 3 deletions minimedia.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ main(int, char**)
#if ANDROID_MAJOR >= 9
FakeActivityManager::instantiate();
#endif

MediaPlayerService::instantiate();
#ifdef AUDIOPOLICYSERVICE_ENABLE
AudioPolicyService::instantiate();
Expand All @@ -74,11 +73,11 @@ main(int, char**)
FakePermissionController::instantiate();
FakeAppOps::instantiate();
FakeBatteryStats::instantiate();
#ifndef SENSORSERVER_DISABLE
#if !defined(SENSORSERVER_DISABLE) && ANDROID_MAJOR <= 9
FakeSensorServer::instantiate();
#endif
#endif
#if ANDROID_MAJOR >= 8
#if ANDROID_MAJOR >= 8 && ANDROID_MAJOR <= 9
sp<android::frameworks::sensorservice::V1_0::ISensorManager> sensorManager = new FakeSensorManager;
status_t status = sensorManager->registerAsService();
(void)status;
Expand Down
122 changes: 0 additions & 122 deletions services/services_10_0_0.h
Original file line number Diff line number Diff line change
Expand Up @@ -442,81 +442,6 @@ class FakeBatteryStats : public BinderService<FakeBatteryStats>,
};


#include <sensor/ISensorServer.h>
#include <sensor/ISensorEventConnection.h>
#include <sensor/Sensor.h>
#include <sensor/BitTube.h>

class FakeSensorEventConnection : public BnSensorEventConnection
{
sp<BitTube> mChannel;
public:
FakeSensorEventConnection()
{
mChannel = new BitTube(0);
}
sp<BitTube> getSensorChannel() const {
return mChannel;
}
status_t enableDisable(int, bool, nsecs_t,
nsecs_t, int) {
return 0;
}
status_t setEventRate(int, nsecs_t) {
return 0;
}
status_t flush() {
return 0;
}

virtual int32_t configureChannel(int32_t, int32_t) {
return 0;
}
protected:
void destroy() {
}

};
class FakeSensorServer : public BinderService<FakeSensorServer>,
public BnSensorServer
{
public:
static char const *getServiceName() {
return "sensorservice";
}

Vector<Sensor> getSensorList(const String16&) {
return Vector<Sensor>();
}

Vector<Sensor> getDynamicSensorList(const String16&) {
return Vector<Sensor>();
}
sp<ISensorEventConnection> createSensorEventConnection(const String8&,
int, const String16&) {
return sp<ISensorEventConnection>(new FakeSensorEventConnection);
}

sp<ISensorEventConnection> createSensorDirectConnection(const String16&,
uint32_t, int32_t, int32_t, const native_handle_t *) {
return sp<ISensorEventConnection>(new FakeSensorEventConnection);
}

int setOperationParameter(
int32_t, int32_t, const Vector<float> &, const Vector<int32_t> &) {
return 0;
}

int32_t isDataInjectionEnabled() {
return 0;
}

virtual status_t shellCommand(int, int, int,
Vector<String16>&) {
return 0;
}
};

#include <media/IResourceManagerService.h>
#include <media/IResourceManagerClient.h>
#include <media/MediaResource.h>
Expand Down Expand Up @@ -570,53 +495,6 @@ class FakeEventQueue :
}
};

class FakeSensorManager :
public android::frameworks::sensorservice::V1_0::ISensorManager
{

// Methods from ::android::frameworks::sensorservice::V1_0::ISensorManager follow.
android::hardware::Return<void> getSensorList(getSensorList_cb _hidl_cb) {
android::hardware::hidl_vec<::android::hardware::sensors::V1_0::SensorInfo> ret;
_hidl_cb(ret, android::frameworks::sensorservice::V1_0::Result::OK);
return android::hardware::Void();
}

android::hardware::Return<void> getDefaultSensor(
android::hardware::sensors::V1_0::SensorType type,
getDefaultSensor_cb _hidl_cb) {
_hidl_cb({}, android::frameworks::sensorservice::V1_0::Result::NOT_EXIST);
return android::hardware::Void();
}

android::hardware::Return<void> createAshmemDirectChannel(
const android::hardware::hidl_memory& mem, uint64_t size,
createAshmemDirectChannel_cb _hidl_cb) {
_hidl_cb(nullptr, android::frameworks::sensorservice::V1_0::Result::BAD_VALUE);
return android::hardware::Void();
}

android::hardware::Return<void> createGrallocDirectChannel(
const android::hardware::hidl_handle& buffer, uint64_t size,
createGrallocDirectChannel_cb _hidl_cb) {
_hidl_cb(nullptr, android::frameworks::sensorservice::V1_0::Result::UNKNOWN_ERROR);
return android::hardware::Void();
}

android::hardware::Return<void> createEventQueue(
const sp<android::frameworks::sensorservice::V1_0::IEventQueueCallback> &callback,
createEventQueue_cb _hidl_cb) {
if (callback == nullptr) {
_hidl_cb(nullptr, android::frameworks::sensorservice::V1_0::Result::BAD_VALUE);
return android::hardware::Void();
}

sp<android::frameworks::sensorservice::V1_0::IEventQueue> queue = new FakeEventQueue();

_hidl_cb(queue, android::frameworks::sensorservice::V1_0::Result::OK);
return android::hardware::Void();
}
};

#include <binder/IActivityManager.h>

class BnFakeActivityManager : public BnInterface<IActivityManager>
Expand Down

0 comments on commit 69a3353

Please sign in to comment.