health: Drop HealthServiceWrapperHidl.init.
Having a separate init function is a bad contract because the client may not call it. Replace it with the constructor. This reduces technical debt. Test: pass Change-Id: I3828903b006c32eb6898d36e64326520ef601ba8
This commit is contained in:
@@ -102,8 +102,7 @@ public abstract class HealthServiceWrapper {
|
||||
@NonNull HealthServiceWrapperHidl.IServiceManagerSupplier hidlServiceManagerSupplier,
|
||||
@NonNull HealthServiceWrapperHidl.IHealthSupplier hidlHealthSupplier)
|
||||
throws RemoteException, NoSuchElementException {
|
||||
HealthServiceWrapperHidl service = new HealthServiceWrapperHidl();
|
||||
service.init(hidlRegCallback, hidlServiceManagerSupplier, hidlHealthSupplier);
|
||||
return service;
|
||||
return new HealthServiceWrapperHidl(
|
||||
hidlRegCallback, hidlServiceManagerSupplier, hidlHealthSupplier);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,12 +56,6 @@ final class HealthServiceWrapperHidl extends HealthServiceWrapper {
|
||||
// Last IHealth service received.
|
||||
private final AtomicReference<IHealth> mLastService = new AtomicReference<>();
|
||||
|
||||
/**
|
||||
* init should be called after constructor. For testing purposes, init is not called by
|
||||
* constructor.
|
||||
*/
|
||||
HealthServiceWrapperHidl() {}
|
||||
|
||||
private static void traceBegin(String name) {
|
||||
Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, name);
|
||||
}
|
||||
@@ -181,7 +175,7 @@ final class HealthServiceWrapperHidl extends HealthServiceWrapper {
|
||||
* @throws NullPointerException when supplier is null
|
||||
*/
|
||||
@VisibleForTesting
|
||||
void init(
|
||||
HealthServiceWrapperHidl(
|
||||
@Nullable Callback callback,
|
||||
@NonNull IServiceManagerSupplier managerSupplier,
|
||||
@NonNull IHealthSupplier healthSupplier)
|
||||
|
||||
Reference in New Issue
Block a user