Search in sources :

Example 1 with SimpleBroadcastReceiver

use of com.android.launcher3.util.SimpleBroadcastReceiver in project android_packages_apps_Launcher3 by AOSPA.

the class WellbeingModel method onInitialized.

@Override
protected void onInitialized(Looper looper) {
    mWorkerHandler = new Handler(looper);
    mContentObserver = newContentObserver(mWorkerHandler, this::onWellbeingUriChanged);
    if (!TextUtils.isEmpty(mWellbeingProviderPkg)) {
        mContext.registerReceiver(new SimpleBroadcastReceiver(t -> restartObserver()), PackageManagerHelper.getPackageFilter(mWellbeingProviderPkg, Intent.ACTION_PACKAGE_ADDED, Intent.ACTION_PACKAGE_CHANGED, Intent.ACTION_PACKAGE_REMOVED, Intent.ACTION_PACKAGE_DATA_CLEARED, Intent.ACTION_PACKAGE_RESTARTED), null, mWorkerHandler);
        IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_ADDED);
        filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
        filter.addDataScheme("package");
        mContext.registerReceiver(new SimpleBroadcastReceiver(this::onAppPackageChanged), filter, null, mWorkerHandler);
        restartObserver();
    }
}
Also used : Context(android.content.Context) Arrays(java.util.Arrays) Bundle(android.os.Bundle) ItemInfo(com.android.launcher3.model.data.ItemInfo) SimpleBroadcastReceiver(com.android.launcher3.util.SimpleBroadcastReceiver) Uri(android.net.Uri) WorkerThread(androidx.annotation.WorkerThread) Preconditions(com.android.launcher3.util.Preconditions) Intent(android.content.Intent) MainThread(androidx.annotation.MainThread) HashMap(java.util.HashMap) LauncherSettings(com.android.launcher3.LauncherSettings) Process(android.os.Process) ContentResolver(android.content.ContentResolver) Handler(android.os.Handler) Looper(android.os.Looper) UserHandle(android.os.UserHandle) Map(java.util.Map) Build(android.os.Build) SCHEME_CONTENT(android.content.ContentResolver.SCHEME_CONTENT) TargetApi(android.annotation.TargetApi) Log(android.util.Log) SystemShortcut(com.android.launcher3.popup.SystemShortcut) ArrayMap(android.util.ArrayMap) MainThreadInitializedObject(com.android.launcher3.util.MainThreadInitializedObject) Utilities.newContentObserver(com.android.launcher3.Utilities.newContentObserver) RemoteAction(android.app.RemoteAction) IntentFilter(android.content.IntentFilter) TextUtils(android.text.TextUtils) FeatureFlags(com.android.launcher3.config.FeatureFlags) BgObjectWithLooper(com.android.launcher3.util.BgObjectWithLooper) BaseDraggingActivity(com.android.launcher3.BaseDraggingActivity) ContentObserver(android.database.ContentObserver) DeadObjectException(android.os.DeadObjectException) LauncherApps(android.content.pm.LauncherApps) InvariantDeviceProfile(com.android.launcher3.InvariantDeviceProfile) Nullable(androidx.annotation.Nullable) R(com.android.launcher3.R) ContentProviderClient(android.content.ContentProviderClient) LauncherProvider(com.android.launcher3.LauncherProvider) RemoteActionShortcut(com.android.launcher3.popup.RemoteActionShortcut) PackageManagerHelper(com.android.launcher3.util.PackageManagerHelper) IntentFilter(android.content.IntentFilter) SimpleBroadcastReceiver(com.android.launcher3.util.SimpleBroadcastReceiver) Handler(android.os.Handler)

Example 2 with SimpleBroadcastReceiver

use of com.android.launcher3.util.SimpleBroadcastReceiver in project android_packages_apps_Launcher3 by ArrowOS.

the class WellbeingModel method onInitialized.

@Override
protected void onInitialized(Looper looper) {
    mWorkerHandler = new Handler(looper);
    mContentObserver = newContentObserver(mWorkerHandler, this::onWellbeingUriChanged);
    if (!TextUtils.isEmpty(mWellbeingProviderPkg)) {
        mContext.registerReceiver(new SimpleBroadcastReceiver(t -> restartObserver()), PackageManagerHelper.getPackageFilter(mWellbeingProviderPkg, Intent.ACTION_PACKAGE_ADDED, Intent.ACTION_PACKAGE_CHANGED, Intent.ACTION_PACKAGE_REMOVED, Intent.ACTION_PACKAGE_DATA_CLEARED, Intent.ACTION_PACKAGE_RESTARTED), null, mWorkerHandler);
        IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_ADDED);
        filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
        filter.addDataScheme("package");
        mContext.registerReceiver(new SimpleBroadcastReceiver(this::onAppPackageChanged), filter, null, mWorkerHandler);
        restartObserver();
    }
}
Also used : Context(android.content.Context) Arrays(java.util.Arrays) Bundle(android.os.Bundle) ItemInfo(com.android.launcher3.model.data.ItemInfo) SimpleBroadcastReceiver(com.android.launcher3.util.SimpleBroadcastReceiver) Uri(android.net.Uri) WorkerThread(androidx.annotation.WorkerThread) Preconditions(com.android.launcher3.util.Preconditions) Intent(android.content.Intent) MainThread(androidx.annotation.MainThread) HashMap(java.util.HashMap) LauncherSettings(com.android.launcher3.LauncherSettings) Process(android.os.Process) ContentResolver(android.content.ContentResolver) Handler(android.os.Handler) Looper(android.os.Looper) UserHandle(android.os.UserHandle) Map(java.util.Map) Build(android.os.Build) SCHEME_CONTENT(android.content.ContentResolver.SCHEME_CONTENT) TargetApi(android.annotation.TargetApi) Log(android.util.Log) SystemShortcut(com.android.launcher3.popup.SystemShortcut) ArrayMap(android.util.ArrayMap) MainThreadInitializedObject(com.android.launcher3.util.MainThreadInitializedObject) Utilities.newContentObserver(com.android.launcher3.Utilities.newContentObserver) RemoteAction(android.app.RemoteAction) IntentFilter(android.content.IntentFilter) TextUtils(android.text.TextUtils) FeatureFlags(com.android.launcher3.config.FeatureFlags) BgObjectWithLooper(com.android.launcher3.util.BgObjectWithLooper) BaseDraggingActivity(com.android.launcher3.BaseDraggingActivity) ContentObserver(android.database.ContentObserver) DeadObjectException(android.os.DeadObjectException) LauncherApps(android.content.pm.LauncherApps) InvariantDeviceProfile(com.android.launcher3.InvariantDeviceProfile) Nullable(androidx.annotation.Nullable) R(com.android.launcher3.R) ContentProviderClient(android.content.ContentProviderClient) LauncherProvider(com.android.launcher3.LauncherProvider) RemoteActionShortcut(com.android.launcher3.popup.RemoteActionShortcut) PackageManagerHelper(com.android.launcher3.util.PackageManagerHelper) IntentFilter(android.content.IntentFilter) SimpleBroadcastReceiver(com.android.launcher3.util.SimpleBroadcastReceiver) Handler(android.os.Handler)

Example 3 with SimpleBroadcastReceiver

use of com.android.launcher3.util.SimpleBroadcastReceiver in project android_packages_apps_Launcher3 by ProtonAOSP.

the class WellbeingModel method onInitialized.

@Override
protected void onInitialized(Looper looper) {
    mWorkerHandler = new Handler(looper);
    mContentObserver = newContentObserver(mWorkerHandler, this::onWellbeingUriChanged);
    if (!TextUtils.isEmpty(mWellbeingProviderPkg)) {
        mContext.registerReceiver(new SimpleBroadcastReceiver(t -> restartObserver()), PackageManagerHelper.getPackageFilter(mWellbeingProviderPkg, Intent.ACTION_PACKAGE_ADDED, Intent.ACTION_PACKAGE_CHANGED, Intent.ACTION_PACKAGE_REMOVED, Intent.ACTION_PACKAGE_DATA_CLEARED, Intent.ACTION_PACKAGE_RESTARTED), null, mWorkerHandler);
        IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_ADDED);
        filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
        filter.addDataScheme("package");
        mContext.registerReceiver(new SimpleBroadcastReceiver(this::onAppPackageChanged), filter, null, mWorkerHandler);
        restartObserver();
    }
}
Also used : Context(android.content.Context) Arrays(java.util.Arrays) Bundle(android.os.Bundle) ItemInfo(com.android.launcher3.model.data.ItemInfo) SimpleBroadcastReceiver(com.android.launcher3.util.SimpleBroadcastReceiver) Uri(android.net.Uri) WorkerThread(androidx.annotation.WorkerThread) Preconditions(com.android.launcher3.util.Preconditions) Intent(android.content.Intent) MainThread(androidx.annotation.MainThread) HashMap(java.util.HashMap) LauncherSettings(com.android.launcher3.LauncherSettings) Process(android.os.Process) ContentResolver(android.content.ContentResolver) Handler(android.os.Handler) Looper(android.os.Looper) UserHandle(android.os.UserHandle) Map(java.util.Map) Build(android.os.Build) SCHEME_CONTENT(android.content.ContentResolver.SCHEME_CONTENT) TargetApi(android.annotation.TargetApi) Log(android.util.Log) SystemShortcut(com.android.launcher3.popup.SystemShortcut) ArrayMap(android.util.ArrayMap) MainThreadInitializedObject(com.android.launcher3.util.MainThreadInitializedObject) Utilities.newContentObserver(com.android.launcher3.Utilities.newContentObserver) RemoteAction(android.app.RemoteAction) IntentFilter(android.content.IntentFilter) TextUtils(android.text.TextUtils) FeatureFlags(com.android.launcher3.config.FeatureFlags) BgObjectWithLooper(com.android.launcher3.util.BgObjectWithLooper) BaseDraggingActivity(com.android.launcher3.BaseDraggingActivity) ContentObserver(android.database.ContentObserver) DeadObjectException(android.os.DeadObjectException) LauncherApps(android.content.pm.LauncherApps) InvariantDeviceProfile(com.android.launcher3.InvariantDeviceProfile) Nullable(androidx.annotation.Nullable) R(com.android.launcher3.R) ContentProviderClient(android.content.ContentProviderClient) LauncherProvider(com.android.launcher3.LauncherProvider) RemoteActionShortcut(com.android.launcher3.popup.RemoteActionShortcut) PackageManagerHelper(com.android.launcher3.util.PackageManagerHelper) IntentFilter(android.content.IntentFilter) SimpleBroadcastReceiver(com.android.launcher3.util.SimpleBroadcastReceiver) Handler(android.os.Handler)

Example 4 with SimpleBroadcastReceiver

use of com.android.launcher3.util.SimpleBroadcastReceiver in project android_packages_apps_404Launcher by P-404.

the class WellbeingModel method onInitialized.

@Override
protected void onInitialized(Looper looper) {
    mWorkerHandler = new Handler(looper);
    mContentObserver = newContentObserver(mWorkerHandler, this::onWellbeingUriChanged);
    if (!TextUtils.isEmpty(mWellbeingProviderPkg)) {
        mContext.registerReceiver(new SimpleBroadcastReceiver(t -> restartObserver()), PackageManagerHelper.getPackageFilter(mWellbeingProviderPkg, Intent.ACTION_PACKAGE_ADDED, Intent.ACTION_PACKAGE_CHANGED, Intent.ACTION_PACKAGE_REMOVED, Intent.ACTION_PACKAGE_DATA_CLEARED, Intent.ACTION_PACKAGE_RESTARTED), null, mWorkerHandler);
        IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_ADDED);
        filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
        filter.addDataScheme("package");
        mContext.registerReceiver(new SimpleBroadcastReceiver(this::onAppPackageChanged), filter, null, mWorkerHandler);
        restartObserver();
    }
}
Also used : Context(android.content.Context) Arrays(java.util.Arrays) Bundle(android.os.Bundle) ItemInfo(com.android.launcher3.model.data.ItemInfo) SimpleBroadcastReceiver(com.android.launcher3.util.SimpleBroadcastReceiver) Uri(android.net.Uri) WorkerThread(androidx.annotation.WorkerThread) Preconditions(com.android.launcher3.util.Preconditions) Intent(android.content.Intent) MainThread(androidx.annotation.MainThread) HashMap(java.util.HashMap) LauncherSettings(com.android.launcher3.LauncherSettings) Process(android.os.Process) ContentResolver(android.content.ContentResolver) Handler(android.os.Handler) Looper(android.os.Looper) UserHandle(android.os.UserHandle) Map(java.util.Map) Build(android.os.Build) SCHEME_CONTENT(android.content.ContentResolver.SCHEME_CONTENT) TargetApi(android.annotation.TargetApi) Log(android.util.Log) SystemShortcut(com.android.launcher3.popup.SystemShortcut) ArrayMap(android.util.ArrayMap) MainThreadInitializedObject(com.android.launcher3.util.MainThreadInitializedObject) Utilities.newContentObserver(com.android.launcher3.Utilities.newContentObserver) RemoteAction(android.app.RemoteAction) IntentFilter(android.content.IntentFilter) TextUtils(android.text.TextUtils) FeatureFlags(com.android.launcher3.config.FeatureFlags) BgObjectWithLooper(com.android.launcher3.util.BgObjectWithLooper) BaseDraggingActivity(com.android.launcher3.BaseDraggingActivity) ContentObserver(android.database.ContentObserver) DeadObjectException(android.os.DeadObjectException) LauncherApps(android.content.pm.LauncherApps) InvariantDeviceProfile(com.android.launcher3.InvariantDeviceProfile) Nullable(androidx.annotation.Nullable) R(com.android.launcher3.R) ContentProviderClient(android.content.ContentProviderClient) LauncherProvider(com.android.launcher3.LauncherProvider) RemoteActionShortcut(com.android.launcher3.popup.RemoteActionShortcut) PackageManagerHelper(com.android.launcher3.util.PackageManagerHelper) IntentFilter(android.content.IntentFilter) SimpleBroadcastReceiver(com.android.launcher3.util.SimpleBroadcastReceiver) Handler(android.os.Handler)

Example 5 with SimpleBroadcastReceiver

use of com.android.launcher3.util.SimpleBroadcastReceiver in project android_packages_apps_Launcher3 by crdroidandroid.

the class WellbeingModel method onInitialized.

@Override
protected void onInitialized(Looper looper) {
    mWorkerHandler = new Handler(looper);
    mContentObserver = newContentObserver(mWorkerHandler, this::onWellbeingUriChanged);
    if (!TextUtils.isEmpty(mWellbeingProviderPkg)) {
        mContext.registerReceiver(new SimpleBroadcastReceiver(t -> restartObserver()), PackageManagerHelper.getPackageFilter(mWellbeingProviderPkg, Intent.ACTION_PACKAGE_ADDED, Intent.ACTION_PACKAGE_CHANGED, Intent.ACTION_PACKAGE_REMOVED, Intent.ACTION_PACKAGE_DATA_CLEARED, Intent.ACTION_PACKAGE_RESTARTED), null, mWorkerHandler);
        IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_ADDED);
        filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
        filter.addDataScheme("package");
        mContext.registerReceiver(new SimpleBroadcastReceiver(this::onAppPackageChanged), filter, null, mWorkerHandler);
        restartObserver();
    }
}
Also used : Context(android.content.Context) Arrays(java.util.Arrays) Bundle(android.os.Bundle) ItemInfo(com.android.launcher3.model.data.ItemInfo) SimpleBroadcastReceiver(com.android.launcher3.util.SimpleBroadcastReceiver) Uri(android.net.Uri) WorkerThread(androidx.annotation.WorkerThread) Preconditions(com.android.launcher3.util.Preconditions) Intent(android.content.Intent) MainThread(androidx.annotation.MainThread) HashMap(java.util.HashMap) LauncherSettings(com.android.launcher3.LauncherSettings) Process(android.os.Process) ContentResolver(android.content.ContentResolver) Handler(android.os.Handler) Looper(android.os.Looper) UserHandle(android.os.UserHandle) Map(java.util.Map) Build(android.os.Build) SCHEME_CONTENT(android.content.ContentResolver.SCHEME_CONTENT) TargetApi(android.annotation.TargetApi) Log(android.util.Log) SystemShortcut(com.android.launcher3.popup.SystemShortcut) ArrayMap(android.util.ArrayMap) MainThreadInitializedObject(com.android.launcher3.util.MainThreadInitializedObject) Utilities.newContentObserver(com.android.launcher3.Utilities.newContentObserver) RemoteAction(android.app.RemoteAction) IntentFilter(android.content.IntentFilter) TextUtils(android.text.TextUtils) FeatureFlags(com.android.launcher3.config.FeatureFlags) BgObjectWithLooper(com.android.launcher3.util.BgObjectWithLooper) BaseDraggingActivity(com.android.launcher3.BaseDraggingActivity) ContentObserver(android.database.ContentObserver) DeadObjectException(android.os.DeadObjectException) LauncherApps(android.content.pm.LauncherApps) InvariantDeviceProfile(com.android.launcher3.InvariantDeviceProfile) Nullable(androidx.annotation.Nullable) R(com.android.launcher3.R) ContentProviderClient(android.content.ContentProviderClient) LauncherProvider(com.android.launcher3.LauncherProvider) RemoteActionShortcut(com.android.launcher3.popup.RemoteActionShortcut) PackageManagerHelper(com.android.launcher3.util.PackageManagerHelper) IntentFilter(android.content.IntentFilter) SimpleBroadcastReceiver(com.android.launcher3.util.SimpleBroadcastReceiver) Handler(android.os.Handler)

Aggregations

TargetApi (android.annotation.TargetApi)5 RemoteAction (android.app.RemoteAction)5 ContentProviderClient (android.content.ContentProviderClient)5 ContentResolver (android.content.ContentResolver)5 SCHEME_CONTENT (android.content.ContentResolver.SCHEME_CONTENT)5 Context (android.content.Context)5 Intent (android.content.Intent)5 IntentFilter (android.content.IntentFilter)5 LauncherApps (android.content.pm.LauncherApps)5 ContentObserver (android.database.ContentObserver)5 Uri (android.net.Uri)5 Build (android.os.Build)5 Bundle (android.os.Bundle)5 DeadObjectException (android.os.DeadObjectException)5 Handler (android.os.Handler)5 Looper (android.os.Looper)5 Process (android.os.Process)5 UserHandle (android.os.UserHandle)5 TextUtils (android.text.TextUtils)5 ArrayMap (android.util.ArrayMap)5