Show the username that the module is installed to (#1887)

This commit is contained in:
Howard Wu 2022-04-23 16:05:35 +08:00 committed by GitHub
parent a0dd9c0866
commit d81b44f8ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 3 deletions

View File

@ -263,6 +263,8 @@ public class LSPManagerService extends ILSPManagerService.Stub {
boolean systemModule) {
try {
var context = new FakeContext();
var userInfo = UserService.getUserInfo(moduleUserId);
String userName = userInfo != null ? userInfo.name : String.valueOf(moduleUserId);
String title = context.getString(enabled ? systemModule ?
R.string.xposed_module_updated_notification_title_system :
R.string.xposed_module_updated_notification_title :
@ -270,7 +272,7 @@ public class LSPManagerService extends ILSPManagerService.Stub {
String content = context.getString(enabled ? systemModule ?
R.string.xposed_module_updated_notification_content_system :
R.string.xposed_module_updated_notification_content :
R.string.module_is_not_activated_yet_detailed, modulePackageName);
R.string.module_is_not_activated_yet_detailed, modulePackageName, userName);
var style = new Notification.BigTextStyle();
style.bigText(content);

View File

@ -95,6 +95,12 @@ public class UserService {
return users;
}
public static UserInfo getUserInfo(int userId) throws RemoteException {
IUserManager um = getUserManager();
if (um == null) return null;
return um.getUserInfo(userId);
}
public static int getProfileParent(int userId) throws RemoteException {
IUserManager um = getUserManager();
if (um == null) return -1;

View File

@ -2,7 +2,7 @@
<resources>
<!-- Notification -->
<string name="module_is_not_activated_yet">Xposed 模块尚未激活</string>
<string name="module_is_not_activated_yet_detailed">%s 已安装,但尚未激活</string>
<string name="module_is_not_activated_yet_detailed">%1$s 已安装到用户 %2$s,但尚未激活</string>
<string name="xposed_module_updated_notification_title">Xposed 模块已更新</string>
<string name="xposed_module_updated_notification_content">%s 已更新,请强行停止并重新打开其作用域内的应用</string>
<string name="xposed_module_updated_notification_title_system">Xposed 模块已更新,需要重新启动</string>

View File

@ -1,7 +1,7 @@
<resources>
<!-- Notification -->
<string name="module_is_not_activated_yet">Xposed module is not activated yet</string>
<string name="module_is_not_activated_yet_detailed">%s has been installed, but is not activated yet</string>
<string name="module_is_not_activated_yet_detailed">%1$s has been installed to user %2$s, but is not activated yet</string>
<string name="xposed_module_updated_notification_title">Xposed module updated</string>
<string name="xposed_module_updated_notification_content">%s has been updated, please force stop and restart apps in its scope</string>
<string name="xposed_module_updated_notification_title_system">Xposed module updated, system reboot required</string>