ChargingControl: Use ServiceManager.waitForDeclaredService()

It might take a while until health HAL is up, thus let's just wait for
it.

Change-Id: Ie929a25a2a774aedb4559662e9ad0a47f1b154e6
This commit is contained in:
LuK1337
2023-07-10 12:05:50 +02:00
committed by Luofan Chen
parent 9ed93717cb
commit c407667d38

View File

@@ -142,7 +142,8 @@ public class ChargingControlController extends LineageHealthFeature {
mContentResolver = mContext.getContentResolver();
mChargingControl = IChargingControl.Stub.asInterface(
ServiceManager.getService(IChargingControl.DESCRIPTOR + "/default"));
ServiceManager.waitForDeclaredService(
IChargingControl.DESCRIPTOR + "/default"));
if (mChargingControl == null) {
Log.i(TAG, "Lineage Health HAL not found");