Skip to content
This repository was archived by the owner on May 3, 2021. It is now read-only.

Commit f523677

Browse files
authored
Merge pull request #1 from LayoutXML/permissions
Permissions
2 parents 7c8609b + 98db084 commit f523677

22 files changed

+395
-153
lines changed

.idea/caches/build_file_checksums.ser

0 Bytes
Binary file not shown.

.idea/misc.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CHANGELOG.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
11
# Changelog for AppListManager (Android Library)
22

3+
## Version 2.0.0
4+
**NOTE**: This version introduces backwards incompatible changes. Follow the steps below on how to solve issues.
5+
6+
- Added ability to filter by application permissions:
7+
- All `getSome...` methods now require two additional parameters - `String[]` (which contains permissions), and `Boolean` (which tells whether to look for applications that contain at least one of the given permissions or not).
8+
- All listeners (except for `sortListener`) - `activityListener`, `appListener`, `newActivityListener`, `newAppListener`, `uninstalledActivityListener`, `uninstalledAppListener` - now receive two additional parameters (look the point above). If not applicable, then they are null and false.
9+
- AppData object now holds application permissions (if you are working with activity lists, this field still contains application permissions) that can be accessed with `getPermissions()` and `setPermissions(...)`.
10+
- `checkApplicationPermissions` method which allows checking whether a single AppData object contains (or does not contain) at least one of the given permissions.
11+
12+
For more information read [README.md](https://github.com/LayoutXML/AppListManager/blob/master/README.md).
13+
314
## Version 1.1.0
415
- Added `BY_APPNAME_IGNORE_CASE` for sorting.
516
- Updated dependencies
617

718
## Version 1.0.0
8-
-
19+
- Initial release

README.md

+50-37
Large diffs are not rendered by default.

app/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ dependencies {
2222
implementation fileTree(dir: 'libs', include: ['*.jar'])
2323
implementation 'com.android.support:appcompat-v7:28.0.0'
2424
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
25-
//implementation project(':applistmanagerlibrary')
25+
implementation project(':applistmanagerlibrary')
2626
testImplementation 'junit:junit:4.12'
2727
androidTestImplementation 'com.android.support.test:runner:1.0.2'
2828
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
2929
implementation 'com.android.support:recyclerview-v7:28.0.0'
30-
implementation 'com.github.LayoutXML:AppListManager:1.1.0'
30+
//implementation 'com.github.LayoutXML:AppListManager:1.1.0'
3131
}

app/src/main/AndroidManifest.xml

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools"
34
package="com.layoutxml.applistmanager">
45

56
<application
@@ -8,7 +9,8 @@
89
android:label="@string/app_name"
910
android:roundIcon="@mipmap/ic_launcher_round"
1011
android:supportsRtl="true"
11-
android:theme="@style/AppTheme">
12+
android:theme="@style/AppTheme"
13+
tools:ignore="GoogleAppIndexingWarning">
1214
<activity android:name=".MainActivity">
1315
<intent-filter>
1416
<action android:name="android.intent.action.MAIN" />

app/src/main/java/com/layoutxml/applistmanager/ListActivity.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,12 @@ protected void onResume() {
108108
}
109109

110110
@Override
111-
public void activityListener(List<AppData> appDataList, Intent intent, Integer activityFlags, Integer applicationFlags, Boolean applicationFlagsMatch, Integer uniqueIdentifier) {
111+
public void activityListener(List<AppData> appDataList, Intent intent, Integer activityFlags, Integer applicationFlags, Boolean applicationFlagsMatch, String[] permissions, Boolean matchPermissions, Integer uniqueIdentifier) {
112112
AppList.sort(appDataList,AppList.BY_APPNAME_IGNORE_CASE,AppList.IN_ASCENDING,uniqueIdentifier);
113113
}
114114

115115
@Override
116-
public void appListener(List<AppData> appDataList, Integer applicationFlags, Boolean applicationFlagsMatch, Integer uniqueIdentifier) {
116+
public void appListener(List<AppData> appDataList, Integer applicationFlags, Boolean applicationFlagsMatch, String[] permissions, Boolean matchPermissions, Integer uniqueIdentifier) {
117117
AppList.sort(appDataList,AppList.BY_APPNAME_IGNORE_CASE,AppList.IN_ASCENDING,uniqueIdentifier);
118118
}
119119

@@ -131,30 +131,30 @@ else if (uniqueIdentifier==2 || uniqueIdentifier==3) {
131131
}
132132

133133
@Override
134-
public void newActivityListener(List<AppData> appDataList, Intent intent, Integer activityFlags, Integer applicationFlags, Boolean applicationFlagsMatch, Boolean fromReceiver, Integer uniqueIdentifier) {
134+
public void newActivityListener(List<AppData> appDataList, Intent intent, Integer activityFlags, Integer applicationFlags, Boolean applicationFlagsMatch, Boolean fromReceiver, String[] permissions, Boolean matchPermissions, Integer uniqueIdentifier) {
135135
if (!apps) {
136136
appDataList.addAll(this.appDataList);
137137
AppList.sort(appDataList,AppList.BY_APPNAME_IGNORE_CASE,AppList.IN_ASCENDING,3);
138138
}
139139
}
140140

141141
@Override
142-
public void newAppListener(List<AppData> appDataList, Integer applicationFlags, Boolean applicationFlagsMatch, Boolean fromReceiver, Integer uniqueIdentifier) {
142+
public void newAppListener(List<AppData> appDataList, Integer applicationFlags, Boolean applicationFlagsMatch, Boolean fromReceiver, String[] permissions, Boolean matchPermissions, Integer uniqueIdentifier) {
143143
if (apps) {
144144
appDataList.addAll(this.appDataList);
145145
AppList.sort(appDataList,AppList.BY_APPNAME_IGNORE_CASE,AppList.IN_ASCENDING,2);
146146
}
147147
}
148148

149149
@Override
150-
public void uninstalledActivityListener(List<AppData> appDataList, Intent intent, Integer activityFlags, Integer applicationFlags, Boolean applicationFlagsMatch, Boolean fromReceiver, Integer uniqueIdentifier) {
150+
public void uninstalledActivityListener(List<AppData> appDataList, Intent intent, Integer activityFlags, Integer applicationFlags, Boolean applicationFlagsMatch, Boolean fromReceiver, String[] permissions, Boolean matchPermissions, Integer uniqueIdentifier) {
151151
if (this.appDataList!=null){
152152
this.appDataList.removeAll(appDataList);
153153
}
154154
}
155155

156156
@Override
157-
public void uninstalledAppListener(List<AppData> appDataList, Boolean fromReceiver, Integer applicationFlags, Boolean applicationFlagsMatch, Integer uniqueIdentifier) {
157+
public void uninstalledAppListener(List<AppData> appDataList, Boolean fromReceiver, Integer applicationFlags, Boolean applicationFlagsMatch, String[] permissions, Boolean matchPermissions, Integer uniqueIdentifier) {
158158
if (this.appDataList!=null){
159159
this.appDataList.removeAll(appDataList);
160160
}

app/src/main/java/com/layoutxml/applistmanager/MainActivity.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public void onClick(View view) {
105105
getAllSystemButton.setOnClickListener(new View.OnClickListener() {
106106
@Override
107107
public void onClick(View view) {
108-
AppList.getSomeApps(getApplicationContext(), ApplicationInfo.FLAG_SYSTEM | ApplicationInfo.FLAG_UPDATED_SYSTEM_APP, true, 3);
108+
AppList.getSomeApps(getApplicationContext(), ApplicationInfo.FLAG_SYSTEM | ApplicationInfo.FLAG_UPDATED_SYSTEM_APP, true, null,false,3);
109109
}
110110
});
111111

@@ -157,7 +157,7 @@ public void onClick(View v) {
157157
}
158158

159159
@Override
160-
public void appListener(List<AppData> appDataList, Integer applicationFlags, Boolean applicationFlagsMatch, Integer uniqueIdentifier) {
160+
public void appListener(List<AppData> appDataList, Integer applicationFlags, Boolean applicationFlagsMatch, String[] permissions, Boolean matchPermissions, Integer uniqueIdentifier) {
161161
if (uniqueIdentifier==0) { //Could also be: if (filterFlags == null)
162162
getAllText.setText("There are now " + appDataList.size() + " apps installed.");
163163
AppList.sort(appDataList,AppList.BY_APPNAME,AppList.IN_ASCENDING,0);
@@ -169,7 +169,7 @@ else if (uniqueIdentifier==3) { //Could also be: else if (filterFlags == (Applic
169169
}
170170

171171
@Override
172-
public void newAppListener(List<AppData> appDataList, Integer applicationFlags, Boolean applicationFlagsMatch, Boolean fromReceiver, Integer uniqueIdentifier) {
172+
public void newAppListener(List<AppData> appDataList, Integer applicationFlags, Boolean applicationFlagsMatch, Boolean fromReceiver, String[] permissions, Boolean matchPermissions, Integer uniqueIdentifier) {
173173
getNewText.setText(appDataList.size()+" new apps installed.");
174174
if (AllAppsList != null) {
175175
AllAppsList.addAll(appDataList);
@@ -178,7 +178,7 @@ public void newAppListener(List<AppData> appDataList, Integer applicationFlags,
178178
}
179179

180180
@Override
181-
public void uninstalledAppListener(List<AppData> appDataList, Boolean fromReceiver, Integer applicationFlags, Boolean applicationFlagsMatch, Integer uniqueIdentifier) {
181+
public void uninstalledAppListener(List<AppData> appDataList, Boolean fromReceiver, Integer applicationFlags, Boolean applicationFlagsMatch, String[] permissions, Boolean matchPermissions, Integer uniqueIdentifier) {
182182
getUninstalledText.setText(appDataList.size()+" apps uninstalled.");
183183
if (AllAppsList!=null) {
184184
AllAppsList.removeAll(appDataList);
@@ -192,15 +192,15 @@ public void sortListener(List<AppData> appDataList, Integer sortBy, Integer inOr
192192
}
193193

194194
@Override
195-
public void activityListener(List<AppData> appDataList, Intent intent, Integer activityFlags, Integer applicationFlags, Boolean applicationFlagsMatch, Integer uniqueIdentifier) {
195+
public void activityListener(List<AppData> appDataList, Intent intent, Integer activityFlags, Integer applicationFlags, Boolean applicationFlagsMatch, String[] permissions, Boolean matchPermissions, Integer uniqueIdentifier) {
196196
if (uniqueIdentifier==4) {
197197
getActivitiesText.setText("There are now " + appDataList.size() + " activities");
198198
AllActivitiesList = appDataList;
199199
}
200200
}
201201

202202
@Override
203-
public void newActivityListener(List<AppData> appDataList, Intent intent, Integer activityFlags, Integer applicationFlags, Boolean applicationFlagsMatch, Boolean fromReceiver, Integer uniqueIdentifier) {
203+
public void newActivityListener(List<AppData> appDataList, Intent intent, Integer activityFlags, Integer applicationFlags, Boolean applicationFlagsMatch, Boolean fromReceiver, String[] permissions, Boolean matchPermissions, Integer uniqueIdentifier) {
204204
getNewActivitiesText.setText(appDataList.size()+" activities added");
205205
if (AllActivitiesList!=null) {
206206
AllActivitiesList.addAll(appDataList);
@@ -209,7 +209,7 @@ public void newActivityListener(List<AppData> appDataList, Intent intent, Intege
209209
}
210210

211211
@Override
212-
public void uninstalledActivityListener(List<AppData> appDataList, Intent intent, Integer activityFlags, Integer applicationFlags, Boolean applicationFlagsMatch, Boolean fromReceiver, Integer uniqueIdentifier) {
212+
public void uninstalledActivityListener(List<AppData> appDataList, Intent intent, Integer activityFlags, Integer applicationFlags, Boolean applicationFlagsMatch, Boolean fromReceiver, String[] permissions, Boolean matchPermissions, Integer uniqueIdentifier) {
213213
getUninstalledActivitiesText.setText(appDataList.size()+" activities removed");
214214
if (AllActivitiesList!=null){
215215
AllActivitiesList.removeAll(appDataList);

0 commit comments

Comments
 (0)