mirror of
https://github.com/topjohnwu/Magisk
synced 2024-11-13 20:54:12 +01: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.INTERNET"/>
|
||||||
<uses-permission android:name="android.permission.VIBRATE" />
|
<uses-permission android:name="android.permission.VIBRATE" />
|
||||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||||
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
|
|
||||||
<uses-permission
|
<uses-permission
|
||||||
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
||||||
android:maxSdkVersion="28" />
|
android:maxSdkVersion="28" />
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.topjohnwu.magisk.view
|
package com.topjohnwu.magisk.view
|
||||||
|
|
||||||
|
import android.annotation.TargetApi
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.pm.ShortcutInfo
|
import android.content.pm.ShortcutInfo
|
||||||
@ -7,8 +8,6 @@ import android.content.pm.ShortcutManager
|
|||||||
import android.os.Build
|
import android.os.Build
|
||||||
import androidx.annotation.RequiresApi
|
import androidx.annotation.RequiresApi
|
||||||
import androidx.core.content.getSystemService
|
import androidx.core.content.getSystemService
|
||||||
import androidx.core.content.pm.ShortcutInfoCompat
|
|
||||||
import androidx.core.content.pm.ShortcutManagerCompat
|
|
||||||
import androidx.core.graphics.drawable.IconCompat
|
import androidx.core.graphics.drawable.IconCompat
|
||||||
import com.topjohnwu.magisk.R
|
import com.topjohnwu.magisk.R
|
||||||
import com.topjohnwu.magisk.core.Const
|
import com.topjohnwu.magisk.core.Const
|
||||||
@ -25,14 +24,16 @@ object Shortcuts {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TargetApi(26)
|
||||||
fun addHomeIcon(context: Context) {
|
fun addHomeIcon(context: Context) {
|
||||||
|
val manager = context.getSystemService<ShortcutManager>() ?: return
|
||||||
val intent = context.packageManager.getLaunchIntentForPackage(context.packageName) ?: 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))
|
.setShortLabel(context.getString(R.string.app_name))
|
||||||
.setIntent(intent)
|
.setIntent(intent)
|
||||||
.setIcon(context.getIconCompat(R.drawable.ic_launcher))
|
.setIcon(context.getIcon(R.drawable.ic_launcher))
|
||||||
.build()
|
.build()
|
||||||
ShortcutManagerCompat.requestPinShortcut(context, info, null)
|
manager.requestPinShortcut(info, null)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Context.getIconCompat(id: Int): IconCompat {
|
private fun Context.getIconCompat(id: Int): IconCompat {
|
||||||
|
Loading…
Reference in New Issue
Block a user