diff --git a/app/src/main/java/com/aurora/store/view/ui/commons/ForceRestartDialog.kt b/app/src/main/java/com/aurora/store/view/ui/commons/ForceRestartDialog.kt index e700ecb40..218cc7201 100644 --- a/app/src/main/java/com/aurora/store/view/ui/commons/ForceRestartDialog.kt +++ b/app/src/main/java/com/aurora/store/view/ui/commons/ForceRestartDialog.kt @@ -1,13 +1,12 @@ package com.aurora.store.view.ui.commons import android.app.Dialog -import android.content.Intent import android.os.Bundle import androidx.fragment.app.DialogFragment import com.aurora.store.R import com.google.android.material.dialog.MaterialAlertDialogBuilder +import com.jakewharton.processphoenix.ProcessPhoenix import dagger.hilt.android.AndroidEntryPoint -import kotlin.system.exitProcess @AndroidEntryPoint class ForceRestartDialog: DialogFragment() { @@ -16,7 +15,9 @@ class ForceRestartDialog: DialogFragment() { return MaterialAlertDialogBuilder(requireContext()) .setTitle(R.string.force_restart_title) .setMessage(R.string.force_restart_summary) - .setPositiveButton(getString(R.string.action_restart)) { _, _ -> restartApp() } + .setPositiveButton(getString(R.string.action_restart)) { _, _ -> + ProcessPhoenix.triggerRebirth(requireContext()) + } .create() } @@ -24,17 +25,4 @@ class ForceRestartDialog: DialogFragment() { super.onResume() dialog?.setCancelable(false) } - - private fun restartApp() { - val context = requireContext() - val intent = context.packageManager.getLaunchIntentForPackage(context.packageName) - val componentName = intent?.component - - val newIntent = Intent.makeRestartActivityTask(componentName).apply { - setPackage(context.packageName) - } - - startActivity(newIntent) - exitProcess(0) - } }