FileDocCategorySizeDatePackage
FakeBackgroundService.javaAPI DocAndroid 5.1 API4300Thu Mar 12 22:22:40 GMT 2015com.android.fakeoemfeatures

FakeBackgroundService

public class FakeBackgroundService extends android.app.Service

Fields Summary
final ArrayList
mAllocs
final Random
mRandom
static final long
TICK_DELAY
static final int
MSG_TICK
final android.os.Handler
mHandler
Constructors Summary
Methods Summary
public android.os.IBinderonBind(android.content.Intent intent)

        return null;
    
public voidonCreate()


        
        super.onCreate();
        mHandler.sendEmptyMessageDelayed(MSG_TICK, TICK_DELAY);

        final WindowManager wm = (WindowManager)getSystemService(Context.WINDOW_SERVICE);
        final Display display = wm.getDefaultDisplay();

        // Make a fake window that is always around eating graphics resources.
        FakeView view = new FakeView(this);
        Dialog dialog = new Dialog(this, android.R.style.Theme_Holo_Dialog);
        dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
        dialog.getWindow().setFlags(
                WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
                | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE
                | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
                | WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
                WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
                | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE
                | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
                | WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED
                | WindowManager.LayoutParams.FLAG_DIM_BEHIND);
        dialog.getWindow().setDimAmount(0);
        dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT);
        WindowManager.LayoutParams lp = dialog.getWindow().getAttributes();
        int maxSize = display.getMaximumSizeDimension();
        maxSize *= 2;
        lp.x = maxSize;
        lp.y = maxSize;
        lp.setTitle(getPackageName() + ":background");
        dialog.getWindow().setAttributes(lp);
        dialog.getWindow().setContentView(view);
        dialog.show();
    
public voidonDestroy()

        super.onDestroy();
        mHandler.removeMessages(MSG_TICK);