Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8814d968 authored by Abel Tesfaye's avatar Abel Tesfaye
Browse files

Fix issue where SmartAutoRotateController tries to unregister an unregistered receiver

Controllers are automatically bound to a lifecycle if registered in the xml file. Manually binding a lifecycle can cause multiple receivers to be unregistered/registered. Removing the manual binding will prevent this case from causing a potential exception.

Bug: 227762968

Test: none
Change-Id: I9c8ddc6f82b19cd4a9c8a4aec3c9c744935cd542
parent 3adc9674
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -35,7 +35,6 @@ import android.provider.Settings;
import android.service.rotationresolver.RotationResolverService;
import android.text.TextUtils;

import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleObserver;
import androidx.lifecycle.OnLifecycleEvent;
import androidx.preference.Preference;
@@ -82,10 +81,6 @@ public class SmartAutoRotateController extends TogglePreferenceController implem
                context);
    }

    public void init(Lifecycle lifecycle) {
        lifecycle.addObserver(this);
    }

    @Override
    public int getAvailabilityStatus() {
        if (!isRotationResolverServiceAvailable(mContext)) {
+0 −1
Original line number Diff line number Diff line
@@ -64,7 +64,6 @@ public class SmartAutoRotatePreferenceFragment extends DashboardFragment {
    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        use(SmartAutoRotateController.class).init(getLifecycle());
        DeviceStateAutoRotationHelper.initControllers(
                getLifecycle(),
                useAll(DeviceStateAutoRotateSettingController.class)