/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.fakeoemfeatures; import static android.view.Display.DEFAULT_DISPLAY; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY; import android.app.Dialog; import android.app.Service; import android.content.Context; import android.content.Intent; import android.graphics.Rect; import android.hardware.display.DisplayManager; import android.os.Handler; import android.os.IBinder; import android.os.Message; import android.view.Display; import android.view.ViewGroup; import android.view.WindowManager; import java.util.ArrayList; import java.util.Random; public class FakeBackgroundService extends Service { final ArrayList mAllocs = new ArrayList(); final Random mRandom = new Random(); static final long TICK_DELAY = 30*1000; // 30 seconds static final int MSG_TICK = 1; final Handler mHandler = new Handler() { @Override public void handleMessage(Message msg) { switch (msg.what) { case MSG_TICK: // We are awesome! To prove we are doing awesome stuff, // we must use some memory! It wouldn't be awesome if // we didn't use memory! for (int i=0; i<5; i++) { try { int[] alloc = new int[FakeApp.PAGE_SIZE/4]; mAllocs.add(alloc); final int VAL = mRandom.nextInt(); for (int j=0; j