use of com.android.settings.notification.NotificationBackend in project android_packages_apps_Settings by omnirom.
the class NotificationAccessDetails method onAttach.
@Override
public void onAttach(Context context) {
super.onAttach(context);
final Intent intent = getIntent();
if (mComponentName == null && intent != null) {
String cn = intent.getStringExtra(Settings.EXTRA_NOTIFICATION_LISTENER_COMPONENT_NAME);
if (cn != null) {
mComponentName = ComponentName.unflattenFromString(cn);
if (mComponentName != null) {
final Bundle args = getArguments();
args.putString(ARG_PACKAGE_NAME, mComponentName.getPackageName());
}
}
}
mPm = getPackageManager();
retrieveAppEntry();
loadNotificationListenerService();
NotificationBackend backend = new NotificationBackend();
int listenerTargetSdk = Build.VERSION_CODES.S;
try {
listenerTargetSdk = mPm.getTargetSdkVersion(mComponentName.getPackageName());
} catch (PackageManager.NameNotFoundException e) {
// how did we get here?
}
use(ApprovalPreferenceController.class).setPkgInfo(mPackageInfo).setCn(mComponentName).setNm(context.getSystemService(NotificationManager.class)).setPm(mPm).setParent(this);
use(HeaderPreferenceController.class).setFragment(this).setPackageInfo(mPackageInfo).setPm(context.getPackageManager()).setServiceName(mServiceName).setBluetoothManager(Utils.getLocalBtManager(context)).setCdm(ICompanionDeviceManager.Stub.asInterface(ServiceManager.getService(Context.COMPANION_DEVICE_SERVICE))).setCn(mComponentName).setUserId(mUserId);
use(PreUpgradePreferenceController.class).setNm(backend).setCn(mComponentName).setUserId(mUserId).setTargetSdk(listenerTargetSdk);
use(BridgedAppsLinkPreferenceController.class).setNm(backend).setCn(mComponentName).setUserId(mUserId).setTargetSdk(listenerTargetSdk);
final int finalListenerTargetSdk = listenerTargetSdk;
getPreferenceControllers().forEach(controllers -> {
controllers.forEach(controller -> {
if (controller instanceof TypeFilterPreferenceController) {
TypeFilterPreferenceController tfpc = (TypeFilterPreferenceController) controller;
tfpc.setNm(backend).setCn(mComponentName).setServiceInfo(mServiceInfo).setUserId(mUserId).setTargetSdk(finalListenerTargetSdk);
}
});
});
}
use of com.android.settings.notification.NotificationBackend in project android_packages_apps_Settings by omnirom.
the class BridgedAppsSettings method onCreate.
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
mShowSystem = icicle != null && icicle.getBoolean(EXTRA_SHOW_SYSTEM);
use(BridgedAppsPreferenceController.class).setNm(new NotificationBackend());
}
use of com.android.settings.notification.NotificationBackend in project android_packages_apps_Settings by omnirom.
the class BubblePreferenceController method applyBubblesApproval.
/**
* Apply global bubbles approval
*/
public static void applyBubblesApproval(Context context, String pkg, int uid, int pref) {
NotificationBackend backend = new NotificationBackend();
backend.setAllowBubbles(pkg, uid, pref);
// changing the global settings will cause the observer on the host page to reload
// correct preference state
Settings.Secure.putInt(context.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
}
use of com.android.settings.notification.NotificationBackend in project android_packages_apps_Settings by omnirom.
the class AppBubbleNotificationSettings method getPreferenceControllers.
protected static List<NotificationPreferenceController> getPreferenceControllers(Context context, AppBubbleNotificationSettings fragment, DependentFieldListener listener) {
List<NotificationPreferenceController> controllers = new ArrayList<>();
controllers.add(new HeaderPreferenceController(context, fragment));
controllers.add(new BubblePreferenceController(context, fragment != null ? fragment.getChildFragmentManager() : null, new NotificationBackend(), true, /* isAppPage */
listener));
controllers.add(new AppBubbleListPreferenceController(context, new NotificationBackend()));
return controllers;
}
use of com.android.settings.notification.NotificationBackend in project android_packages_apps_Settings by omnirom.
the class NotificationHistoryActivity method onResume.
@Override
protected void onResume() {
super.onResume();
mPm = getPackageManager();
mUm = getSystemService(UserManager.class);
// wait for history loading and recent/snooze loading
mCountdownLatch = new CountDownLatch(2);
mTodayView.removeAllViews();
mHistoryLoader = new HistoryLoader(this, new NotificationBackend(), mPm);
mHistoryLoader.load(mOnHistoryLoaderListener);
mNm = INotificationManager.Stub.asInterface(ServiceManager.getService(Context.NOTIFICATION_SERVICE));
try {
mListener.registerAsSystemService(this, new ComponentName(getPackageName(), this.getClass().getCanonicalName()), ActivityManager.getCurrentUser());
} catch (RemoteException e) {
Log.e(TAG, "Cannot register listener", e);
}
bindSwitch();
mCountdownFuture = ThreadUtils.postOnBackgroundThread(() -> {
try {
mCountdownLatch.await(2, TimeUnit.SECONDS);
} catch (InterruptedException e) {
Slog.e(TAG, "timed out waiting for loading", e);
}
ThreadUtils.postOnMainThread(() -> {
if (mSwitchBar.isChecked() && findViewById(R.id.today_list).getVisibility() == View.GONE && mSnoozeView.getVisibility() == View.GONE && mDismissView.getVisibility() == View.GONE) {
mHistoryOn.setVisibility(View.GONE);
mHistoryEmpty.setVisibility(View.VISIBLE);
}
});
});
mUiEventLogger.log(NotificationHistoryEvent.NOTIFICATION_HISTORY_OPEN);
}
Aggregations