mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-02 08:56:55 +00:00
Listening only for "android" package for overlay changes
Bug: 130917995 Change-Id: I37160a886a0afdc02dca8f7da6e8aa54c795882d
This commit is contained in:
@@ -21,6 +21,7 @@ import android.content.ActivityNotFoundException;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.LauncherActivityInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
@@ -30,6 +31,7 @@ import android.graphics.Rect;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.PatternMatcher;
|
||||
import android.os.UserHandle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
@@ -200,4 +202,17 @@ public class PackageManagerHelper {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an intent filter to listen for actions with a specific package in the data field.
|
||||
*/
|
||||
public static IntentFilter getPackageFilter(String pkg, String... actions) {
|
||||
IntentFilter packageFilter = new IntentFilter();
|
||||
for (String action : actions) {
|
||||
packageFilter.addAction(action);
|
||||
}
|
||||
packageFilter.addDataScheme("package");
|
||||
packageFilter.addDataSchemeSpecificPart(pkg, PatternMatcher.PATTERN_LITERAL);
|
||||
return packageFilter;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user