Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
48c40f95
Commit
48c40f95
authored
Oct 17, 2018
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent Resources
Fix #619
parent
e0e76747
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
21 deletions
+26
-21
ApplicationAdapter.java
...ava/com/topjohnwu/magisk/adapters/ApplicationAdapter.java
+5
-19
Policy.java
app/src/full/java/com/topjohnwu/magisk/container/Policy.java
+3
-1
SuperuserFragment.java
...ava/com/topjohnwu/magisk/fragments/SuperuserFragment.java
+1
-1
Utils.java
app/src/full/java/com/topjohnwu/magisk/utils/Utils.java
+17
-0
No files found.
app/src/full/java/com/topjohnwu/magisk/adapters/ApplicationAdapter.java
View file @
48c40f95
...
@@ -3,8 +3,6 @@ package com.topjohnwu.magisk.adapters;
...
@@ -3,8 +3,6 @@ package com.topjohnwu.magisk.adapters;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.pm.ApplicationInfo
;
import
android.content.pm.ApplicationInfo
;
import
android.content.pm.PackageManager
;
import
android.content.pm.PackageManager
;
import
android.content.res.Configuration
;
import
android.content.res.Resources
;
import
android.os.AsyncTask
;
import
android.os.AsyncTask
;
import
android.text.TextUtils
;
import
android.text.TextUtils
;
import
android.view.LayoutInflater
;
import
android.view.LayoutInflater
;
...
@@ -17,8 +15,8 @@ import android.widget.TextView;
...
@@ -17,8 +15,8 @@ import android.widget.TextView;
import
com.topjohnwu.magisk.Const
;
import
com.topjohnwu.magisk.Const
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.utils.LocaleManager
;
import
com.topjohnwu.magisk.utils.Topic
;
import
com.topjohnwu.magisk.utils.Topic
;
import
com.topjohnwu.magisk.utils.Utils
;
import
com.topjohnwu.superuser.Shell
;
import
com.topjohnwu.superuser.Shell
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -52,19 +50,6 @@ public class ApplicationAdapter extends RecyclerView.Adapter<ApplicationAdapter.
...
@@ -52,19 +50,6 @@ public class ApplicationAdapter extends RecyclerView.Adapter<ApplicationAdapter.
return
new
ViewHolder
(
v
);
return
new
ViewHolder
(
v
);
}
}
private
String
getLabel
(
ApplicationInfo
info
)
{
if
(
info
.
labelRes
>
0
)
{
try
{
Resources
res
=
pm
.
getResourcesForApplication
(
info
);
Configuration
config
=
new
Configuration
();
config
.
setLocale
(
LocaleManager
.
locale
);
res
.
updateConfiguration
(
config
,
res
.
getDisplayMetrics
());
return
res
.
getString
(
info
.
labelRes
);
}
catch
(
PackageManager
.
NameNotFoundException
ignored
)
{
/* Impossible */
}
}
return
info
.
loadLabel
(
pm
).
toString
();
}
private
void
loadApps
()
{
private
void
loadApps
()
{
fullList
=
pm
.
getInstalledApplications
(
0
);
fullList
=
pm
.
getInstalledApplications
(
0
);
hideList
=
Shell
.
su
(
"magiskhide --ls"
).
exec
().
getOut
();
hideList
=
Shell
.
su
(
"magiskhide --ls"
).
exec
().
getOut
();
...
@@ -78,7 +63,8 @@ public class ApplicationAdapter extends RecyclerView.Adapter<ApplicationAdapter.
...
@@ -78,7 +63,8 @@ public class ApplicationAdapter extends RecyclerView.Adapter<ApplicationAdapter.
boolean
ah
=
hideList
.
contains
(
a
.
packageName
);
boolean
ah
=
hideList
.
contains
(
a
.
packageName
);
boolean
bh
=
hideList
.
contains
(
b
.
packageName
);
boolean
bh
=
hideList
.
contains
(
b
.
packageName
);
if
(
ah
==
bh
)
{
if
(
ah
==
bh
)
{
return
getLabel
(
a
).
toLowerCase
().
compareTo
(
getLabel
(
b
).
toLowerCase
());
return
Utils
.
getAppLabel
(
a
,
pm
).
toLowerCase
()
.
compareTo
(
Utils
.
getAppLabel
(
b
,
pm
).
toLowerCase
());
}
else
if
(
ah
)
{
}
else
if
(
ah
)
{
return
-
1
;
return
-
1
;
}
else
{
}
else
{
...
@@ -93,7 +79,7 @@ public class ApplicationAdapter extends RecyclerView.Adapter<ApplicationAdapter.
...
@@ -93,7 +79,7 @@ public class ApplicationAdapter extends RecyclerView.Adapter<ApplicationAdapter.
ApplicationInfo
info
=
showList
.
get
(
position
);
ApplicationInfo
info
=
showList
.
get
(
position
);
holder
.
appIcon
.
setImageDrawable
(
info
.
loadIcon
(
pm
));
holder
.
appIcon
.
setImageDrawable
(
info
.
loadIcon
(
pm
));
holder
.
appName
.
setText
(
getLabel
(
info
));
holder
.
appName
.
setText
(
Utils
.
getAppLabel
(
info
,
pm
));
holder
.
appPackage
.
setText
(
info
.
packageName
);
holder
.
appPackage
.
setText
(
info
.
packageName
);
holder
.
checkBox
.
setOnCheckedChangeListener
(
null
);
holder
.
checkBox
.
setOnCheckedChangeListener
(
null
);
...
@@ -149,7 +135,7 @@ public class ApplicationAdapter extends RecyclerView.Adapter<ApplicationAdapter.
...
@@ -149,7 +135,7 @@ public class ApplicationAdapter extends RecyclerView.Adapter<ApplicationAdapter.
showList
=
new
ArrayList
<>();
showList
=
new
ArrayList
<>();
String
filter
=
constraint
.
toString
().
toLowerCase
();
String
filter
=
constraint
.
toString
().
toLowerCase
();
for
(
ApplicationInfo
info
:
fullList
)
{
for
(
ApplicationInfo
info
:
fullList
)
{
if
(
lowercaseContains
(
getLabel
(
info
),
filter
)
if
(
lowercaseContains
(
Utils
.
getAppLabel
(
info
,
pm
),
filter
)
||
lowercaseContains
(
info
.
packageName
,
filter
))
{
||
lowercaseContains
(
info
.
packageName
,
filter
))
{
showList
.
add
(
info
);
showList
.
add
(
info
);
}
}
...
...
app/src/full/java/com/topjohnwu/magisk/container/Policy.java
View file @
48c40f95
...
@@ -5,6 +5,8 @@ import android.content.pm.ApplicationInfo;
...
@@ -5,6 +5,8 @@ import android.content.pm.ApplicationInfo;
import
android.content.pm.PackageManager
;
import
android.content.pm.PackageManager
;
import
android.database.Cursor
;
import
android.database.Cursor
;
import
com.topjohnwu.magisk.utils.Utils
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.NonNull
;
...
@@ -26,7 +28,7 @@ public class Policy implements Comparable<Policy>{
...
@@ -26,7 +28,7 @@ public class Policy implements Comparable<Policy>{
this
.
uid
=
uid
;
this
.
uid
=
uid
;
packageName
=
pkgs
[
0
];
packageName
=
pkgs
[
0
];
info
=
pm
.
getApplicationInfo
(
packageName
,
0
);
info
=
pm
.
getApplicationInfo
(
packageName
,
0
);
appName
=
info
.
loadLabel
(
pm
).
toString
(
);
appName
=
Utils
.
getAppLabel
(
info
,
pm
);
}
}
public
Policy
(
Cursor
c
,
PackageManager
pm
)
throws
PackageManager
.
NameNotFoundException
{
public
Policy
(
Cursor
c
,
PackageManager
pm
)
throws
PackageManager
.
NameNotFoundException
{
...
...
app/src/full/java/com/topjohnwu/magisk/fragments/SuperuserFragment.java
View file @
48c40f95
...
@@ -31,7 +31,7 @@ public class SuperuserFragment extends BaseFragment {
...
@@ -31,7 +31,7 @@ public class SuperuserFragment extends BaseFragment {
View
view
=
inflater
.
inflate
(
R
.
layout
.
fragment_superuser
,
container
,
false
);
View
view
=
inflater
.
inflate
(
R
.
layout
.
fragment_superuser
,
container
,
false
);
unbinder
=
new
SuperuserFragment_ViewBinding
(
this
,
view
);
unbinder
=
new
SuperuserFragment_ViewBinding
(
this
,
view
);
pm
=
get
Activity
().
getPackageManager
();
pm
=
require
Activity
().
getPackageManager
();
return
view
;
return
view
;
}
}
...
...
app/src/full/java/com/topjohnwu/magisk/utils/Utils.java
View file @
48c40f95
...
@@ -6,6 +6,10 @@ import android.content.ComponentName;
...
@@ -6,6 +6,10 @@ import android.content.ComponentName;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.content.SharedPreferences
;
import
android.content.SharedPreferences
;
import
android.content.pm.ApplicationInfo
;
import
android.content.pm.PackageManager
;
import
android.content.res.Configuration
;
import
android.content.res.Resources
;
import
android.database.Cursor
;
import
android.database.Cursor
;
import
android.net.Uri
;
import
android.net.Uri
;
import
android.os.AsyncTask
;
import
android.os.AsyncTask
;
...
@@ -123,4 +127,17 @@ public class Utils {
...
@@ -123,4 +127,17 @@ public class Utils {
Topic
.
publish
(
Topic
.
MODULE_LOAD_DONE
,
moduleMap
);
Topic
.
publish
(
Topic
.
MODULE_LOAD_DONE
,
moduleMap
);
});
});
}
}
public
static
String
getAppLabel
(
ApplicationInfo
info
,
PackageManager
pm
)
{
try
{
if
(
info
.
labelRes
>
0
)
{
Resources
res
=
pm
.
getResourcesForApplication
(
info
);
Configuration
config
=
new
Configuration
();
config
.
setLocale
(
LocaleManager
.
locale
);
res
.
updateConfiguration
(
config
,
res
.
getDisplayMetrics
());
return
res
.
getString
(
info
.
labelRes
);
}
}
catch
(
Exception
ignored
)
{}
return
info
.
loadLabel
(
pm
).
toString
();
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment