1 /* 2 * Copyright (C) 2017 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 com.android.cts.ephemeralapp1; 18 19 import android.app.Service; 20 import android.content.Intent; 21 import android.content.pm.PackageInfo; 22 import android.content.pm.PackageManager.NameNotFoundException; 23 import android.os.Binder; 24 import android.os.IBinder; 25 import android.os.IInterface; 26 import android.os.Parcel; 27 import android.os.RemoteException; 28 import android.os.ResultReceiver; 29 import android.os.ShellCallback; 30 import android.util.Log; 31 32 import com.android.cts.util.TestResult; 33 34 import java.io.FileDescriptor; 35 36 public class EphemeralService extends Service { 37 38 @Override 39 public IBinder onBind(Intent intent) { 40 TestResult.getBuilder() 41 .setPackageName("com.android.cts.ephemeralapp1") 42 .setComponentName("EphemeralService") 43 .setMethodName("onBind") 44 .setIntent(intent) 45 .setStatus("PASS") 46 .build() 47 .broadcast(this); 48 return new Binder(); 49 } 50 51 @Override 52 public int onStartCommand(Intent intent, int flags, int startId) { 53 TestResult.getBuilder() 54 .setPackageName("com.android.cts.ephemeralapp1") 55 .setComponentName("EphemeralService") 56 .setMethodName("onStartCommand") 57 .setIntent(intent) 58 .setStatus("PASS") 59 .build() 60 .broadcast(this); 61 return super.onStartCommand(intent, flags, startId); 62 } 63 } 64