• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 package android.autofillservice.cts;
17 
18 import android.os.CancellationSignal;
19 import android.service.autofill.AutofillService;
20 import android.service.autofill.FillCallback;
21 import android.service.autofill.FillRequest;
22 import android.service.autofill.SaveCallback;
23 import android.service.autofill.SaveRequest;
24 import android.util.Log;
25 
26 /**
27  * An {@link AutofillService} implementation that does fails if called upon.
28  */
29 public class BadAutofillService extends AutofillService {
30 
31     private static final String TAG = "BadAutofillService";
32 
33     static final String SERVICE_NAME = BadAutofillService.class.getPackage().getName()
34             + "/." + BadAutofillService.class.getSimpleName();
35     static final String SERVICE_LABEL = "BadAutofillService";
36 
37     @Override
onFillRequest(FillRequest request, CancellationSignal cancellationSignal, FillCallback callback)38     public void onFillRequest(FillRequest request, CancellationSignal cancellationSignal,
39             FillCallback callback) {
40         Log.e(TAG, "onFillRequest() should never be called");
41         throw new UnsupportedOperationException("onFillRequest() should never be called");
42     }
43 
44     @Override
onSaveRequest(SaveRequest request, SaveCallback callback)45     public void onSaveRequest(SaveRequest request, SaveCallback callback) {
46         Log.e(TAG, "onSaveRequest() should never be called");
47         throw new UnsupportedOperationException("onSaveRequest() should never be called");
48     }
49 }
50