1 /* 2 * Copyright (C) 2008 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.app.cts; 18 19 import android.app.LauncherActivity; 20 import android.content.Intent; 21 import android.os.Bundle; 22 import android.view.View; 23 import android.widget.ListView; 24 25 public class LauncherActivityStub extends LauncherActivity { 26 public boolean isOnCreateCalled = false; 27 public boolean isOnListItemClick = false; 28 // For testing LauncherActivity#getTargetIntent() 29 private Intent mSuperIntent; 30 31 public Intent getSuperIntent() { 32 return mSuperIntent; 33 } 34 35 @Override 36 protected Intent getTargetIntent() { 37 mSuperIntent = super.getTargetIntent(); 38 Intent targetIntent = new Intent(Intent.ACTION_MAIN, null); 39 targetIntent.addCategory(Intent.CATEGORY_FRAMEWORK_INSTRUMENTATION_TEST); 40 targetIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 41 return targetIntent; 42 } 43 44 @Override 45 protected Intent intentForPosition(int position) { 46 return super.intentForPosition(position); 47 } 48 49 public LauncherActivityStub() { 50 super(); 51 } 52 53 @Override 54 protected void onCreate(Bundle savedInstanceState) { 55 super.onCreate(savedInstanceState); 56 isOnCreateCalled = true; 57 } 58 59 @Override 60 public void onListItemClick(ListView l, View v, int position, long id) { 61 super.onListItemClick(l, v, position, id); 62 isOnListItemClick = true; 63 } 64 } 65