use of com.android.keyguard.KeyguardHostView.OnDismissAction in project android_frameworks_base by DirtyUnicorns.
the class BaseStatusBar method bindGuts.
private void bindGuts(final ExpandableNotificationRow row) {
row.inflateGuts();
final StatusBarNotification sbn = row.getStatusBarNotification();
PackageManager pmUser = getPackageManagerForUser(mContext, sbn.getUser().getIdentifier());
row.setTag(sbn.getPackageName());
final NotificationGuts guts = row.getGuts();
guts.setClosedListener(this);
final String pkg = sbn.getPackageName();
String appname = pkg;
Drawable pkgicon = null;
int appUid = -1;
try {
final ApplicationInfo info = pmUser.getApplicationInfo(pkg, PackageManager.GET_UNINSTALLED_PACKAGES | PackageManager.GET_DISABLED_COMPONENTS);
if (info != null) {
appname = String.valueOf(pmUser.getApplicationLabel(info));
pkgicon = pmUser.getApplicationIcon(info);
appUid = info.uid;
}
} catch (NameNotFoundException e) {
// app is gone, just show package name and generic icon
pkgicon = pmUser.getDefaultActivityIcon();
}
((ImageView) guts.findViewById(R.id.app_icon)).setImageDrawable(pkgicon);
((TextView) guts.findViewById(R.id.pkgname)).setText(appname);
final TextView settingsButton = (TextView) guts.findViewById(R.id.more_settings);
if (appUid >= 0) {
final int appUidF = appUid;
settingsButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
MetricsLogger.action(mContext, MetricsEvent.ACTION_NOTE_INFO);
guts.resetFalsingCheck();
startAppNotificationSettingsActivity(pkg, appUidF);
}
});
settingsButton.setText(R.string.notification_more_settings);
} else {
settingsButton.setVisibility(View.GONE);
}
guts.bindImportance(pmUser, sbn, mNonBlockablePkgs, mNotificationData.getImportance(sbn.getKey()));
final TextView doneButton = (TextView) guts.findViewById(R.id.done);
doneButton.setText(R.string.notification_done);
doneButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// If the user has security enabled, show challenge if the setting is changed.
if (guts.hasImportanceChanged() && isLockscreenPublicMode() && (mState == StatusBarState.KEYGUARD || mState == StatusBarState.SHADE_LOCKED)) {
OnDismissAction dismissAction = new OnDismissAction() {
@Override
public boolean onDismiss() {
saveImportanceCloseControls(sbn, row, guts, v);
return true;
}
};
onLockedNotificationImportanceChange(dismissAction);
} else {
saveImportanceCloseControls(sbn, row, guts, v);
}
}
});
}
use of com.android.keyguard.KeyguardHostView.OnDismissAction in project android_frameworks_base by AOSPA.
the class BaseStatusBar method startNotificationGutsIntent.
private void startNotificationGutsIntent(final Intent intent, final int appUid) {
final boolean keyguardShowing = mStatusBarKeyguardViewManager.isShowing();
dismissKeyguardThenExecute(new OnDismissAction() {
@Override
public boolean onDismiss() {
AsyncTask.execute(new Runnable() {
public void run() {
try {
if (keyguardShowing) {
ActivityManagerNative.getDefault().keyguardWaitingForActivityDrawn();
}
TaskStackBuilder.create(mContext).addNextIntentWithParentStack(intent).startActivities(getActivityOptions(), new UserHandle(UserHandle.getUserId(appUid)));
overrideActivityPendingAppTransition(keyguardShowing);
} catch (RemoteException e) {
}
}
});
animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL, true);
return true;
}
}, false);
}
use of com.android.keyguard.KeyguardHostView.OnDismissAction in project android_frameworks_base by ResurrectionRemix.
the class PhoneStatusBar method executeRunnableDismissingKeyguard.
public void executeRunnableDismissingKeyguard(final Runnable runnable, final Runnable cancelAction, final boolean dismissShade, final boolean afterKeyguardGone, final boolean deferred) {
final boolean keyguardShowing = mStatusBarKeyguardViewManager.isShowing();
dismissKeyguardThenExecute(new OnDismissAction() {
@Override
public boolean onDismiss() {
AsyncTask.execute(new Runnable() {
@Override
public void run() {
try {
if (keyguardShowing && !afterKeyguardGone) {
ActivityManagerNative.getDefault().keyguardWaitingForActivityDrawn();
}
if (runnable != null) {
runnable.run();
}
} catch (RemoteException e) {
}
}
});
if (dismissShade) {
animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL, true, /* force */
true);
}
return deferred;
}
}, cancelAction, afterKeyguardGone);
}
use of com.android.keyguard.KeyguardHostView.OnDismissAction in project android_frameworks_base by ResurrectionRemix.
the class BaseStatusBar method startNotificationGutsIntent.
private void startNotificationGutsIntent(final Intent intent, final int appUid) {
final boolean keyguardShowing = mStatusBarKeyguardViewManager.isShowing();
dismissKeyguardThenExecute(new OnDismissAction() {
@Override
public boolean onDismiss() {
AsyncTask.execute(new Runnable() {
public void run() {
try {
if (keyguardShowing) {
ActivityManagerNative.getDefault().keyguardWaitingForActivityDrawn();
}
TaskStackBuilder.create(mContext).addNextIntentWithParentStack(intent).startActivities(getActivityOptions(), new UserHandle(UserHandle.getUserId(appUid)));
overrideActivityPendingAppTransition(keyguardShowing);
} catch (RemoteException e) {
}
}
});
animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL, true);
return true;
}
}, false);
}
use of com.android.keyguard.KeyguardHostView.OnDismissAction in project android_frameworks_base by crdroidandroid.
the class BaseStatusBar method bindGuts.
private void bindGuts(final ExpandableNotificationRow row) {
row.inflateGuts();
final StatusBarNotification sbn = row.getStatusBarNotification();
PackageManager pmUser = getPackageManagerForUser(mContext, sbn.getUser().getIdentifier());
row.setTag(sbn.getPackageName());
final NotificationGuts guts = row.getGuts();
guts.setClosedListener(this);
final String pkg = sbn.getPackageName();
String appname = pkg;
Drawable pkgicon = null;
int appUid = -1;
try {
final ApplicationInfo info = pmUser.getApplicationInfo(pkg, PackageManager.GET_UNINSTALLED_PACKAGES | PackageManager.GET_DISABLED_COMPONENTS);
if (info != null) {
appname = String.valueOf(pmUser.getApplicationLabel(info));
pkgicon = pmUser.getApplicationIcon(info);
appUid = info.uid;
}
} catch (NameNotFoundException e) {
// app is gone, just show package name and generic icon
pkgicon = pmUser.getDefaultActivityIcon();
}
((ImageView) guts.findViewById(R.id.app_icon)).setImageDrawable(pkgicon);
((TextView) guts.findViewById(R.id.pkgname)).setText(appname);
final TextView settingsButton = (TextView) guts.findViewById(R.id.more_settings);
if (appUid >= 0) {
final int appUidF = appUid;
settingsButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
MetricsLogger.action(mContext, MetricsEvent.ACTION_NOTE_INFO);
guts.resetFalsingCheck();
startAppNotificationSettingsActivity(pkg, appUidF);
}
});
settingsButton.setText(R.string.notification_more_settings);
} else {
settingsButton.setVisibility(View.GONE);
}
guts.bindImportance(pmUser, sbn, mNonBlockablePkgs, mNotificationData.getImportance(sbn.getKey()));
final TextView doneButton = (TextView) guts.findViewById(R.id.done);
doneButton.setText(R.string.notification_done);
doneButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// If the user has security enabled, show challenge if the setting is changed.
if (guts.hasImportanceChanged() && isLockscreenPublicMode() && (mState == StatusBarState.KEYGUARD || mState == StatusBarState.SHADE_LOCKED)) {
OnDismissAction dismissAction = new OnDismissAction() {
@Override
public boolean onDismiss() {
saveImportanceCloseControls(sbn, row, guts, v);
return true;
}
};
onLockedNotificationImportanceChange(dismissAction);
} else {
saveImportanceCloseControls(sbn, row, guts, v);
}
}
});
}
Aggregations