-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Open Audio Player in another unprivileged process
Even if App Manager runs in the privileged mode, the Audio Player will run in a separate unprivileged process, reducing attack surface for third-party malicious apps as well as preventing the player from closing in case the system runs out of resources (the latter is still in progress). Note: The process retains all the permissions granted to App Manager. So, it's NOT an effective process isolation technique, and various attack surface are still present. In an ideal process isolation technique, the audio should be played using an isolated service with limited permissions. Such technique will be explored in the future. Signed-off-by: Muntashir Al-Islam <[email protected]>
- Loading branch information
1 parent
291fa8c
commit b42162d
Showing
5 changed files
with
68 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
app/src/main/java/io/github/muntashirakon/AppManager/PerProcessActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
package io.github.muntashirakon.AppManager; | ||
|
||
import android.annotation.SuppressLint; | ||
import android.os.Bundle; | ||
import android.view.Menu; | ||
|
||
import androidx.activity.EdgeToEdge; | ||
import androidx.annotation.CallSuper; | ||
import androidx.annotation.IdRes; | ||
import androidx.annotation.Nullable; | ||
import androidx.appcompat.app.AppCompatActivity; | ||
import androidx.appcompat.view.menu.MenuBuilder; | ||
import androidx.fragment.app.Fragment; | ||
import androidx.fragment.app.FragmentManager; | ||
|
||
public class PerProcessActivity extends AppCompatActivity { | ||
@CallSuper | ||
@Override | ||
protected void onCreate(@Nullable Bundle savedInstanceState) { | ||
EdgeToEdge.enable(this); | ||
super.onCreate(savedInstanceState); | ||
} | ||
|
||
public boolean getTransparentBackground() { | ||
return false; | ||
} | ||
|
||
@CallSuper | ||
@SuppressLint("RestrictedApi") | ||
@Override | ||
public boolean onCreateOptionsMenu(Menu menu) { | ||
if (menu instanceof MenuBuilder) { | ||
((MenuBuilder) menu).setOptionalIconsVisible(true); | ||
} | ||
return super.onCreateOptionsMenu(menu); | ||
} | ||
|
||
protected void clearBackStack() { | ||
FragmentManager fragmentManager = getSupportFragmentManager(); | ||
if (fragmentManager.getBackStackEntryCount() > 0) { | ||
FragmentManager.BackStackEntry entry = fragmentManager.getBackStackEntryAt(0); | ||
fragmentManager.popBackStackImmediate(entry.getId(), FragmentManager.POP_BACK_STACK_INCLUSIVE); | ||
} | ||
} | ||
|
||
protected void removeCurrentFragment(@IdRes int id) { | ||
Fragment fragment = getSupportFragmentManager().findFragmentById(id); | ||
if (fragment != null) { | ||
getSupportFragmentManager() | ||
.beginTransaction() | ||
.remove(fragment) | ||
.commit(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters