use of android.app.Dialog in project android_frameworks_base by ParanoidAndroid.
the class VolumePreference method cleanup.
/**
* Do clean up. This can be called multiple times!
*/
private void cleanup() {
getPreferenceManager().unregisterOnActivityStopListener(this);
if (mSeekBarVolumizer != null) {
Dialog dialog = getDialog();
if (dialog != null && dialog.isShowing()) {
View view = dialog.getWindow().getDecorView().findViewById(com.android.internal.R.id.seekbar);
if (view != null)
view.setOnKeyListener(null);
// Stopped while dialog was showing, revert changes
mSeekBarVolumizer.revertVolume();
}
mSeekBarVolumizer.stop();
mSeekBarVolumizer = null;
}
}
use of android.app.Dialog in project android_frameworks_base by ParanoidAndroid.
the class FakeApp method onCreate.
@Override
public void onCreate() {
String processName = ActivityThread.currentProcessName();
Slog.i("FakeOEMFeatures", "Creating app in process: " + processName);
if (!getApplicationInfo().packageName.equals(processName)) {
// our extra overhead stuff.
return;
}
final WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
final Display display = wm.getDefaultDisplay();
// is a user build, WARN! Do not want!
if ("user".equals(android.os.Build.TYPE)) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Should not be on user build");
builder.setMessage("The app Fake OEM Features should not be installed on a " + "user build. Please remove this .apk before shipping this build to " + " your customers!");
builder.setCancelable(false);
builder.setPositiveButton("I understand", null);
Dialog dialog = builder.create();
dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
dialog.show();
}
// Make a fake window that is always around eating graphics resources.
FakeView view = new FakeView(this);
WindowManager.LayoutParams lp = new WindowManager.LayoutParams(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
if (ActivityManager.isHighEndGfx()) {
lp.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;
}
lp.width = ViewGroup.LayoutParams.MATCH_PARENT;
lp.height = ViewGroup.LayoutParams.MATCH_PARENT;
int maxSize = display.getMaximumSizeDimension();
maxSize *= 2;
lp.x = maxSize;
lp.y = maxSize;
lp.setTitle(getPackageName());
wm.addView(view, lp);
// Bind to a fake service we want to keep running in another process.
bindService(new Intent(this, FakeCoreService.class), mServiceConnection, Context.BIND_AUTO_CREATE);
bindService(new Intent(this, FakeCoreService2.class), mServiceConnection2, Context.BIND_AUTO_CREATE);
bindService(new Intent(this, FakeCoreService3.class), mServiceConnection3, Context.BIND_AUTO_CREATE);
// Start to a fake service that should run in the background of
// another process.
mHandler.sendEmptyMessage(MSG_TICK);
// Make a fake allocation to consume some RAM.
mStuffing = new int[STUFFING_SIZE_INTS];
for (int i = 0; i < STUFFING_SIZE_BYTES / PAGE_SIZE; i++) {
// Fill each page with a unique value.
final int VAL = i * 2 + 100;
final int OFF = (i * PAGE_SIZE) / 4;
for (int j = 0; j < (PAGE_SIZE / 4); j++) {
mStuffing[OFF + j] = VAL;
}
}
}
use of android.app.Dialog in project android_frameworks_base by ParanoidAndroid.
the class BrightnessTile method showBrightnessDialog.
private void showBrightnessDialog() {
if (mBrightnessDialog == null) {
mBrightnessDialog = new Dialog(mContext);
mBrightnessDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
mBrightnessDialog.setContentView(R.layout.quick_settings_brightness_dialog);
mBrightnessDialog.setCanceledOnTouchOutside(true);
new BrightnessController(mContext, (ImageView) mBrightnessDialog.findViewById(R.id.brightness_icon), (ToggleSlider) mBrightnessDialog.findViewById(R.id.brightness_slider));
mBrightnessDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
mBrightnessDialog.getWindow().getAttributes().privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS;
mBrightnessDialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
}
if (!mBrightnessDialog.isShowing()) {
try {
WindowManagerGlobal.getWindowManagerService().dismissKeyguard();
} catch (RemoteException e) {
// Do nothing here
}
mBrightnessDialog.show();
dismissBrightnessDialog(mBrightnessDialogLongTimeout);
}
}
use of android.app.Dialog in project android_frameworks_base by ParanoidAndroid.
the class BugReportTile method showBugreportDialog.
private void showBugreportDialog() {
final AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
builder.setPositiveButton(com.android.internal.R.string.report, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (which == DialogInterface.BUTTON_POSITIVE) {
// Add a little delay before executing, to give the
// dialog a chance to go away before it takes a
// screenshot.
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
try {
ActivityManagerNative.getDefault().requestBugReport();
} catch (RemoteException e) {
}
}
}, 500);
}
}
});
builder.setMessage(com.android.internal.R.string.bugreport_message);
builder.setTitle(com.android.internal.R.string.bugreport_title);
builder.setCancelable(true);
final Dialog dialog = builder.create();
dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
try {
WindowManagerGlobal.getWindowManagerService().dismissKeyguard();
} catch (RemoteException e) {
}
dialog.show();
}
use of android.app.Dialog in project android_frameworks_base by ParanoidAndroid.
the class QuickSettings method showBugreportDialog.
private void showBugreportDialog() {
final AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
builder.setPositiveButton(com.android.internal.R.string.report, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (which == DialogInterface.BUTTON_POSITIVE) {
// Add a little delay before executing, to give the
// dialog a chance to go away before it takes a
// screenshot.
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
try {
ActivityManagerNative.getDefault().requestBugReport();
} catch (RemoteException e) {
}
}
}, 500);
}
}
});
builder.setMessage(com.android.internal.R.string.bugreport_message);
builder.setTitle(com.android.internal.R.string.bugreport_title);
builder.setCancelable(true);
final Dialog dialog = builder.create();
dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
try {
WindowManagerGlobal.getWindowManagerService().dismissKeyguard();
} catch (RemoteException e) {
}
dialog.show();
}
Aggregations