diff --git a/device-common.mk b/device-common.mk
index d27500d..473d570 100644
--- a/device-common.mk
+++ b/device-common.mk
@@ -183,7 +183,7 @@
 
 # Haptics
 PRODUCT_PACKAGES += \
-    android.hardware.vibrator@1.1-service.sdm845
+    android.hardware.vibrator@1.1-service.ff
 
 # Copy standard platform config files
 PRODUCT_COPY_FILES +=  \
diff --git a/vibrator/Android.bp b/vibrator/Android.bp
deleted file mode 100644
index 653457c..0000000
--- a/vibrator/Android.bp
+++ /dev/null
@@ -1,31 +0,0 @@
-//
-// Copyright (C) 2021 The Android Open Source 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.
-cc_binary {
-    name: "android.hardware.vibrator@1.1-service.sdm845",
-    vendor: true,
-    relative_install_path: "hw",
-    init_rc: ["android.hardware.vibrator@1.1-service.sdm845.rc"],
-    srcs: ["service.cpp", "Vibrator.cpp"],
-    cflags: ["-Wall", "-Werror"],
-    shared_libs: [
-        "libhidlbase",
-        "libcutils",
-        "liblog",
-        "libutils",
-        "libhardware",
-        "android.hardware.vibrator@1.0",
-        "android.hardware.vibrator@1.1",
-    ],
-}
diff --git a/vibrator/Vibrator.cpp b/vibrator/Vibrator.cpp
deleted file mode 100644
index 50aef4f..0000000
--- a/vibrator/Vibrator.cpp
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source 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.
- */
-
-/* Adapted from Crosshatch downstream:
- * https://github.com/GrapheneOS/device_google_crosshatch/blob/c7f62a539b6cb4685348fbd747605cbfabf1b94d/vibrator/Vibrator.cpp
- */
-
-#define LOG_TAG "VibratorService"
-
-#include <log/log.h>
-
-#include <hardware/hardware.h>
-#include <hardware/vibrator.h>
-#include <cutils/properties.h>
-#include <linux/input.h>
-
-#include "Vibrator.h"
-
-#include <cinttypes>
-#include <cmath>
-#include <iostream>
-#include <fstream>
-#include <cstring>
-
-namespace android {
-namespace hardware {
-namespace vibrator {
-namespace V1_1 {
-namespace implementation {
-
-using Status = ::android::hardware::vibrator::V1_0::Status;
-using EffectStrength = ::android::hardware::vibrator::V1_0::EffectStrength;
-using Effect = ::android::hardware::vibrator::V1_1::Effect_1_1;
-
-/*
- * These have to be kept in line with HAL version
- */
-static constexpr Effect MAX_EFFECT = Effect::TICK;
-static constexpr EffectStrength MAX_EFFECT_STRENGTH = EffectStrength::STRONG;
-
-/**
- * Helper to index effects in the mEffects map.
- * from their strength and effect type.
- */
-#define EFFECT_INDEX(effect, strength) \
-	((uint16_t)effect * (uint16_t)MAX_EFFECT_STRENGTH + (uint16_t)strength)
-
-static constexpr int DEFAULT_EFFECT_ID = EFFECT_INDEX(Effect::CLICK, EffectStrength::MEDIUM);
-
-Vibrator::Vibrator(std::string devpath) :
-	mInputDevPath(devpath)
-{
-	// We just keep the input device open the whole time we're running.
-	// Closing / reopening it seems to break things.
-	if (mInputDevPath.length() < 2) {
-		mIsStub = true;
-		return;
-	}
-	mfd = openInputDev();
-	if (mfd < 0) {
-		ALOGE("%s() can't open FF input device %s", __func__, mInputDevPath.c_str());
-		return;
-	}
-
-	// Build a table of effects for each strength of each effect.
-	int baseStrength = 0;
-	for (uint16_t i = 0; i <= (uint16_t)MAX_EFFECT; i++)
-	{
-		for (uint16_t j = 0; j <= (uint16_t)MAX_EFFECT_STRENGTH; j++)
-		{
-			switch((Effect)i) {
-				default:
-				case Effect::CLICK:
-					baseStrength = 0x4000;
-					break;
-				case Effect::TICK:
-					baseStrength = 0x1000;
-					break;
-				case Effect::DOUBLE_CLICK:
-					baseStrength = 0x3000;
-					break;
-			}
-			ALOGV("%s() uploading effect %d, strength %d, magnitude = 0x%x", __func__, i, j, baseStrength + j * 0x1000);
-			// 0x8000 is about the max for qcom_spmi_haptics.
-			mEffects[EFFECT_INDEX(i, j)] = FF_EFFECT((uint16_t)(baseStrength + j * 0x800));
-
-			uploadEffectToKernel(&mEffects[EFFECT_INDEX(i, j)]);
-		}
-	}
-}
-
-int Vibrator::openInputDev() {
-	if (mIsStub)
-		return 0;
-	return open(mInputDevPath.c_str(), O_RDWR|O_CLOEXEC);
-}
-
-void Vibrator::uploadEffectToKernel(struct ff_effect* effect) {
-	int ret;
-	if (mIsStub)
-		return;
-	
-	ret = ioctl(mfd, EVIOCSFF, effect);
-	if (ret < 0) {
-		ALOGE("%s() Couldn't upload rumble effect to device %s, ret = %d", __func__, mInputDevPath.c_str(), ret);
-	}
-}
-
-void Vibrator::deleteEffectFromKernel(struct ff_effect* effect) { // Unload rumble effect
-	int ret;
-	if (mIsStub)
-		return;
-	
-	ret = ioctl(mfd, EVIOCRMFF, effect);
-	if (ret < 0) {
-		ALOGE("%s() Failed to remove rumble effect from device %s, ret = %d", __func__, mInputDevPath.c_str(), ret);
-		return;
-	}
-	effect->id = -1;
-}
-
-// Methods from ::android::hardware::vibrator::V1_1::IVibrator follow.
-Return<Status> Vibrator::on(uint32_t timeoutMs) {
-	struct ff_effect* effect;
-	if (mIsStub)
-		return Status::OK;
-	// If the active effect is set, use it instead of the default
-	if (mActiveEffectId < 0) {
-		effect = &mEffects[DEFAULT_EFFECT_ID];
-	} else {
-		effect = &mEffects[mActiveEffectId];
-	}
-
-	ALOGV("%s() mActiveEffectId = %d, timeoutMs = %d, effect.id = %d, magnitude = %d", __func__, mActiveEffectId, timeoutMs, effect->id, effect->u.rumble.strong_magnitude);
-	struct input_event play;
-	int ret;
-
-	play.type = EV_FF;
-	play.code = effect->id;
-	play.value = 1;
-
-	ret = write(mfd, (const void*) &play, sizeof(play));
-	if (ret != sizeof(play)) {
-		ALOGE("%s() failed to fully write play event to input device: %d", __func__, errno);
-		return Status::UNKNOWN_ERROR;
-	}
-
-	usleep(timeoutMs * 1000);
-
-	off();
-
-	return Status::OK;
-}
-
-Return<Status> Vibrator::off()  {
-	ALOGV("%s", __func__);
-	struct input_event stop;
-	struct ff_effect* effect;
-	if (mIsStub)
-		return Status::OK;
-	// If the active effect is set, use it instead of the default
-	if (mActiveEffectId < 0) {
-		ALOGV("%s() no active effect, stopping default", __func__);
-		effect = &mEffects[DEFAULT_EFFECT_ID];
-	} else {
-		effect = &mEffects[mActiveEffectId];
-	}
-
-	stop.type = EV_FF;
-	stop.code = effect->id;
-	stop.value = 0;
-	if (write(mfd, (const void*) &stop, sizeof(stop)) != sizeof(stop)) {
-		ALOGE("%s() failed to fully write stop event to input device", __func__);
-		return Status::UNKNOWN_ERROR;
-	}
-
-	return Status::OK;
-}
-
-Return<bool> Vibrator::supportsAmplitudeControl()  {
-	ALOGV("%s", __func__);
-	return false;
-}
-
-Return<Status> Vibrator::setAmplitude(uint8_t amplitude) {
-	ALOGV("%s", __func__);
-
-	if (!amplitude) {
-		return Status::BAD_VALUE;
-	}
-
-	return Status::OK;
-}
-
-Return<void> Vibrator::perform(V1_0::Effect effect, EffectStrength strength,
-		perform_cb _hidl_cb) {
-	return performWrapper(effect, strength, _hidl_cb);
-}
-
-Return<void> Vibrator::perform_1_1(V1_1::Effect_1_1 effect, EffectStrength strength,
-		perform_cb _hidl_cb) {
-	return performWrapper(effect, strength, _hidl_cb);
-}
-
-template <typename T>
-Return<void> Vibrator::performWrapper(T effect, EffectStrength strength, perform_cb _hidl_cb) {
-	ALOGV("%s, ", __func__);
-	auto validRange = hidl_enum_range<T>();
-	if (effect < *validRange.begin() || effect > *std::prev(validRange.end())) {
-		_hidl_cb(Status::UNSUPPORTED_OPERATION, 0);
-		return Void();
-	}
-	return performEffect(static_cast<Effect>(effect), strength, _hidl_cb);
-}
-
-Return<void> Vibrator::performEffect(Effect effect, EffectStrength strength,
-		perform_cb _hidl_cb) {
-	Status status = Status::OK;
-	uint32_t timeMs = 9;
-	bool doubleClick = effect == Effect::DOUBLE_CLICK;
-
-	ALOGV("%s() effect = %d, strength = %d", __func__, effect, (int)strength);
-
-	if (effect > MAX_EFFECT || mIsStub){
-		_hidl_cb(Status::UNSUPPORTED_OPERATION, 0);
-		return Void();
-	}
-
-	mActiveEffectId = EFFECT_INDEX(effect, strength);
-
-	// Play the effect
-	on(timeMs);
-	/*
-	 * Android calls off() for us, so
-	 * only call it if we're doing a double click
-	 */
-	if (doubleClick) {
-		timeMs += 59;
-		usleep(50 * 1000);
-		on(timeMs);
-	}
-	mActiveEffectId = -1;
-
-	_hidl_cb(status, timeMs);
-
-	return Void();
-}
-
-Vibrator::~Vibrator() {
-	close(mfd);
-}
-
-
-} // namespace implementation
-}  // namespace V1_1
-}  // namespace vibrator
-}  // namespace hardware
-}  // namespace android
\ No newline at end of file
diff --git a/vibrator/Vibrator.h b/vibrator/Vibrator.h
deleted file mode 100644
index 2dc8cb0..0000000
--- a/vibrator/Vibrator.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source 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.
- */
-#ifndef ANDROID_HARDWARE_VIBRATOR_V1_1_VIBRATOR_H
-#define ANDROID_HARDWARE_VIBRATOR_V1_1_VIBRATOR_H
-
-#include <android/hardware/vibrator/1.1/IVibrator.h>
-#include <hidl/Status.h>
-
-#include <linux/input.h>
-
-#include <fstream>
-#include <map>
-
-// Borrowed from linuxconsole/utils/bitmaskros.h
-/* Number of bits for 1 unsigned char */
-#define nBitsPerUchar          (sizeof(unsigned char) * 8)
-/* Index=Offset of given bit in 1 unsigned char */
-#define bitOffsetInUchar(bit)  ((bit)%nBitsPerUchar)
-/* Index=Offset of the unsigned char associated to the bit
- * at the given index=offset
- */
-#define ucharIndexForBit(bit)  ((bit)/nBitsPerUchar)
-/* Test the bit with given index=offset in an unsigned char array */
-#define testBit(bit, array)    ((array[ucharIndexForBit(bit)] >> bitOffsetInUchar(bit)) & 1)
-
-/**
- * Builder for ff_effect struct.
- * We don't bother using weak_magnitude here as most hardware
- * doesn't have any way to differentiate strong / weak haptics
- */
-#define FF_EFFECT(rumbleStrenth)		\
-	{					\
-		.type = FF_RUMBLE,		\
-		.id = -1,			\
-		.direction = 0,			\
-		.trigger = {			\
-			.button = 0,		\
-			.interval = 0,		\
-		},				\
-		.replay = {			\
-			.length = 0,		\
-			.delay = 0,		\
-		},				\
-		.u = {				\
-			.rumble = {		\
-			.strong_magnitude = rumbleStrenth, \
-			.weak_magnitude = 0,	\
-			},			\
-		},				\
-	}
-
-namespace android {
-namespace hardware {
-namespace vibrator {
-namespace V1_1 {
-namespace implementation {
-
-class Vibrator : public IVibrator {
-public:
-	Vibrator(std::string mInputDevPath);
-
-	// Methods from ::android::hardware::vibrator::V1_0::IVibrator follow.
-	using Status = ::android::hardware::vibrator::V1_0::Status;
-	Return<Status> on(uint32_t timeoutMs)  override;
-	Return<Status> off()  override;
-	Return<bool> supportsAmplitudeControl() override;
-	Return<Status> setAmplitude(uint8_t amplitude) override;
-
-	using EffectStrength = ::android::hardware::vibrator::V1_0::EffectStrength;
-	Return<void> perform(V1_0::Effect effect, EffectStrength strength, perform_cb _hidl_cb)
-			override;
-	Return<void> perform_1_1(Effect_1_1 effect, EffectStrength strength, perform_cb _hidl_cb)
-			override;
-
-private:
-	~Vibrator();
-	void uploadEffectToKernel(struct ff_effect*);
-	void deleteEffectFromKernel(struct ff_effect*);
-	int openInputDev();
-	template <typename T>
-	Return<void> performWrapper(T effect, EffectStrength strength, perform_cb _hidl_cb);
-	Return<void> performEffect(Effect_1_1 effect, EffectStrength strength, perform_cb _hidl_cb);
-	std::string mInputDevPath;
-	int mfd;
-	int mActiveEffectId;
-	// If the haptics device path is invalid
-	// the just stub all behaviour. Otherwise
-	// the device will fail to boot because the haptics
-	// service keeps crashing.
-	bool mIsStub;
-	// Look up table of effects by type and strength
-	std::map<int, struct ff_effect> mEffects;
-
-};
-
-}  // namespace implementation
-}  // namespace V1_1
-}  // namespace vibrator
-}  // namespace hardware
-}  // namespace android
-
-class FileDescGuard {
-	public:
-		FileDescGuard(int fd) : m_fd(fd) {}
-
-		~FileDescGuard() {
-			if (close(m_fd) != 0)
-			{
-				ALOGE("CA:: Failed to close fd %d, errno = %d", m_fd, errno);
-			}
-		}
-	private:
-		int m_fd = -1;
-};
-
-#endif  // ANDROID_HARDWARE_VIBRATOR_V1_1_VIBRATOR_H
diff --git a/vibrator/android.hardware.vibrator@1.1-service.sdm845.rc b/vibrator/android.hardware.vibrator@1.1-service.sdm845.rc
deleted file mode 100644
index a47743a..0000000
--- a/vibrator/android.hardware.vibrator@1.1-service.sdm845.rc
+++ /dev/null
@@ -1,4 +0,0 @@
-service vendor.vibrator-1-1 /vendor/bin/hw/android.hardware.vibrator@1.1-service.sdm845
-    class hal
-    user system
-    group system
diff --git a/vibrator/service.cpp b/vibrator/service.cpp
deleted file mode 100644
index f81da17..0000000
--- a/vibrator/service.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source 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.
- */
-#define LOG_TAG "android.hardware.vibrator@1.2-service.sdm845"
-
-#include <log/log.h>
-
-#include <android/hardware/vibrator/1.1/IVibrator.h>
-#include <hidl/HidlSupport.h>
-#include <hidl/HidlTransportSupport.h>
-#include <utils/Errors.h>
-#include <utils/StrongPointer.h>
-
-#include <linux/input.h>
-
-#include <iostream>
-#include <stdio.h>
-#include <dirent.h>
-#include <fcntl.h>
-
-#include "Vibrator.h"
-
-#define DEV_INPUT_DIR "/dev/input"
-
-using android::hardware::configureRpcThreadpool;
-using android::hardware::joinRpcThreadpool;
-using android::hardware::vibrator::V1_1::IVibrator;
-using android::hardware::vibrator::V1_1::implementation::Vibrator;
-using namespace android;
-
-// From : https://github.com/ubports/hfd-service/blob/xenial/src/vibrator-ff.cpp#L46
-static bool inputDevSupportsFF(std::string devname) {
-    int ret;
-	unsigned char features[1 + FF_MAX/8/sizeof(unsigned char)];
-	int tempFd = open(devname.c_str(), O_RDWR);
-	int request = EVIOCGBIT(EV_FF, sizeof(features)*sizeof(unsigned char));
-	bool supported = false;
-
-    ALOGV("%s: Testing device: %s", __func__, devname.c_str());
-
-	if ((ret = ioctl(tempFd, request, &features)) < 0) {
-        ALOGE("%s: ioctl() failed with errno = %d", __func__, ret);
-		supported = false;
-    }
-	if (testBit(FF_RUMBLE, features)) {
-		supported = true;
-	}
-
-	close(tempFd);
-	return supported;
-}
-
-// Returns path event path to to the first input device
-// which supports forcefeedback.
-// Adapted from getevent.c (I know this is bad)
-static std::string findFirstFFDevice() {
-    char devname[PATH_MAX];
-    char *filename;
-    struct dirent *de;
-    DIR *dir = opendir(DEV_INPUT_DIR);
-    if (dir == NULL)
-        return NULL;
-    strcpy(devname, DEV_INPUT_DIR);
-    filename = devname + strlen(devname);
-    *filename++ = '/';
-    while((de = readdir(dir))) {
-        if (std::string(de->d_name).find("event") == std::string::npos)
-            continue;
-        strcpy(filename, de->d_name);
-        // At this point devname is the full path to the dirent
-        std::string devpath(devname);
-        if (inputDevSupportsFF(devpath)) {
-            closedir(dir);
-            ALOGV("%s(): Found haptics device: %s", __func__, devpath.c_str());
-            return devpath;
-        }
-    }
-    closedir(dir);
-    return "";
-}
-
-
-status_t registerVibratorService() {
-    std::string hapticsDev = findFirstFFDevice();
-    if (hapticsDev.length() < 2)
-        ALOGE("Couldn't find a haptics device, stubbing HAL to prevent"
-              " boot failing");
-    sp<IVibrator> vibrator = new Vibrator(hapticsDev);
-
-    return vibrator->registerAsService();
-}
-
-int main() {
-    configureRpcThreadpool(1, true);
-    status_t status = registerVibratorService();
-
-    if (status != OK) {
-        return status;
-    }
-
-    joinRpcThreadpool();
-}
