Skip to content

Commit

Permalink
* Fixed problem where ActivityManager.getRunningAppProcesses() can re…
Browse files Browse the repository at this point in the history
…turn a null list
  • Loading branch information
mindbirth authored Jul 14, 2017
1 parent 9df2dbb commit 1f67098
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion snapservices.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Snap Library Version
version = 1.2.2
version = 1.2.3
4 changes: 2 additions & 2 deletions snapservices/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ android {
targetSdkVersion 26

buildConfigField "String", "SNAP_SERVICES_VERSION", "\"${project.version}\""
proguardFiles 'consumer-proguard.pro'
//proguardFiles 'consumer-proguard.pro'
}
buildTypes {
release {
minifyEnabled true
minifyEnabled false
}

debug {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.android.snap.snapservices.logger.SnapLogger;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
Expand Down Expand Up @@ -497,7 +498,14 @@ boolean verifyIfIsForkedProcess() {
int myPid = android.os.Process.myPid();
ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);

for (ActivityManager.RunningAppProcessInfo processInfo : manager.getRunningAppProcesses()) {
List<ActivityManager.RunningAppProcessInfo> runningAppProcesses = manager.getRunningAppProcesses();

if (runningAppProcesses == null) {
SnapLogger.v("Running App Processes list is null. Assume this is not the forked process. Hurrah Android!");
return false;
}

for (ActivityManager.RunningAppProcessInfo processInfo : runningAppProcesses) {
if (processInfo.pid == myPid) {
String currentProcName = processInfo.processName;
if (!TextUtils.isEmpty(currentProcName)
Expand Down

0 comments on commit 1f67098

Please sign in to comment.