mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-26 18:27:38 +00:00
Remove unnecessary permissions
This commit is contained in:
parent
354440ee8a
commit
65f88e4ae2
@ -6,7 +6,6 @@
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
|
||||
<uses-permission
|
||||
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
||||
android:maxSdkVersion="28" />
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.topjohnwu.magisk.view
|
||||
|
||||
import android.annotation.TargetApi
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.pm.ShortcutInfo
|
||||
@ -7,8 +8,6 @@ import android.content.pm.ShortcutManager
|
||||
import android.os.Build
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.core.content.getSystemService
|
||||
import androidx.core.content.pm.ShortcutInfoCompat
|
||||
import androidx.core.content.pm.ShortcutManagerCompat
|
||||
import androidx.core.graphics.drawable.IconCompat
|
||||
import com.topjohnwu.magisk.R
|
||||
import com.topjohnwu.magisk.core.Const
|
||||
@ -25,14 +24,16 @@ object Shortcuts {
|
||||
}
|
||||
}
|
||||
|
||||
@TargetApi(26)
|
||||
fun addHomeIcon(context: Context) {
|
||||
val manager = context.getSystemService<ShortcutManager>() ?: return
|
||||
val intent = context.packageManager.getLaunchIntentForPackage(context.packageName) ?: return
|
||||
val info = ShortcutInfoCompat.Builder(context, Const.Nav.HOME)
|
||||
val info = ShortcutInfo.Builder(context, Const.Nav.HOME)
|
||||
.setShortLabel(context.getString(R.string.app_name))
|
||||
.setIntent(intent)
|
||||
.setIcon(context.getIconCompat(R.drawable.ic_launcher))
|
||||
.setIcon(context.getIcon(R.drawable.ic_launcher))
|
||||
.build()
|
||||
ShortcutManagerCompat.requestPinShortcut(context, info, null)
|
||||
manager.requestPinShortcut(info, null)
|
||||
}
|
||||
|
||||
private fun Context.getIconCompat(id: Int): IconCompat {
|
||||
|
Loading…
x
Reference in New Issue
Block a user