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

Commit c86d61fc authored by Michael Wachenschwanz's avatar Michael Wachenschwanz
Browse files

Fix PowerStatsView AppPicker activity start

Move registerForActivityResult to intialize.

Bug: n/a
Test: manual
Change-Id: I9b91ed272a83512f3aef1801d7a8d837cb1aebcd
parent 7b327a68
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.widget.ImageView;
import android.widget.TextView;

import androidx.activity.ComponentActivity;
import androidx.activity.result.ActivityResultLauncher;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.loader.app.LoaderManager;
@@ -60,6 +61,8 @@ public class PowerStatsViewerActivity extends ComponentActivity {
    private RecyclerView mPowerStatsDataView;
    private View mLoadingView;
    private View mEmptyView;
    private ActivityResultLauncher<Void> mStartAppPicker = registerForActivityResult(
            PowerConsumerPickerActivity.CONTRACT, this::onApplicationSelected);

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
@@ -105,8 +108,7 @@ public class PowerStatsViewerActivity extends ComponentActivity {
    }

    private void startAppPicker() {
        registerForActivityResult(PowerConsumerPickerActivity.CONTRACT, this::onApplicationSelected)
                .launch(null);
        mStartAppPicker.launch(null);
    }

    private void onApplicationSelected(String powerConsumerId) {