@@ -57,6 +57,7 @@ object SuCallbackHandler {
5757 val toUid = data.getIntComp(" to.uid" , - 1 )
5858 val pid = data.getIntComp(" pid" , - 1 )
5959 val command = data.getString(" command" , " " )
60+ val legacyCmd = data.getBoolean(" legacy_cmd" , false )
6061 val target = data.getIntComp(" target" , - 1 )
6162 val seContext = data.getString(" context" , " " )
6263 val gids = data.getString(" gids" , " " )
@@ -70,7 +71,7 @@ object SuCallbackHandler {
7071 }.getOrNull() ? : createSuLog(fromUid, toUid, pid, command, policy, target, seContext, gids)
7172
7273 if (notify)
73- notify(context, log.action >= SuPolicy .ALLOW , log.appName)
74+ notify(context, log.action >= SuPolicy .ALLOW , log.appName, legacyCmd )
7475
7576 runBlocking { ServiceLocator .logRepo.insert(log) }
7677 }
@@ -79,24 +80,30 @@ object SuCallbackHandler {
7980 val uid = data.getIntComp(" from.uid" , - 1 )
8081 val pid = data.getIntComp(" pid" , - 1 )
8182 val policy = data.getIntComp(" policy" , SuPolicy .ALLOW )
83+ val legacyCmd = data.getBoolean(" legacy_cmd" , false )
8284
8385 val pm = context.packageManager
8486
8587 val appName = runCatching {
8688 pm.getPackageInfo(uid, pid)?.applicationInfo?.getLabel(pm)
8789 }.getOrNull() ? : " [UID] $uid "
8890
89- notify(context, policy >= SuPolicy .ALLOW , appName)
91+ notify(context, policy >= SuPolicy .ALLOW , appName, legacyCmd )
9092 }
9193
92- private fun notify (context : Context , granted : Boolean , appName : String ) {
94+ private fun notify (context : Context , granted : Boolean ,
95+ appName : String , legacyCmd : Boolean ) {
9396 if (Config .suNotification == Config .Value .NOTIFICATION_TOAST ) {
9497 val resId = if (granted)
9598 R .string.su_allow_toast
9699 else
97100 R .string.su_deny_toast
98101
99- context.toast(context.getString(resId, appName), Toast .LENGTH_SHORT )
102+ var str = context.getString(resId, appName)
103+ if (legacyCmd) {
104+ str + = " \n ${context.getString(R .string.su_legacy_cmd)} "
105+ }
106+ context.toast(str, Toast .LENGTH_SHORT )
100107 }
101108 }
102109}
0 commit comments