1cd2969c85de5214375de9911c07c205c211c366fFelipe Leme/*
2cd2969c85de5214375de9911c07c205c211c366fFelipe Leme * Copyright (C) 2017 The Android Open Source Project
3cd2969c85de5214375de9911c07c205c211c366fFelipe Leme *
4cd2969c85de5214375de9911c07c205c211c366fFelipe Leme * Licensed under the Apache License, Version 2.0 (the "License");
5cd2969c85de5214375de9911c07c205c211c366fFelipe Leme * you may not use this file except in compliance with the License.
6cd2969c85de5214375de9911c07c205c211c366fFelipe Leme * You may obtain a copy of the License at
7cd2969c85de5214375de9911c07c205c211c366fFelipe Leme *
8cd2969c85de5214375de9911c07c205c211c366fFelipe Leme *      http://www.apache.org/licenses/LICENSE-2.0
9cd2969c85de5214375de9911c07c205c211c366fFelipe Leme *
10cd2969c85de5214375de9911c07c205c211c366fFelipe Leme * Unless required by applicable law or agreed to in writing, software
11cd2969c85de5214375de9911c07c205c211c366fFelipe Leme * distributed under the License is distributed on an "AS IS" BASIS,
12cd2969c85de5214375de9911c07c205c211c366fFelipe Leme * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13cd2969c85de5214375de9911c07c205c211c366fFelipe Leme * See the License for the specific language governing permissions and
14cd2969c85de5214375de9911c07c205c211c366fFelipe Leme * limitations under the License.
15cd2969c85de5214375de9911c07c205c211c366fFelipe Leme */
16cd2969c85de5214375de9911c07c205c211c366fFelipe Lemepackage android.service.autofill;
17cd2969c85de5214375de9911c07c205c211c366fFelipe Leme
18cd2969c85de5214375de9911c07c205c211c366fFelipe Lemeimport android.annotation.NonNull;
19f5059c39cbf72603c6a28ae9337041ddce5d4899Felipe Lemeimport android.annotation.Nullable;
20cd2969c85de5214375de9911c07c205c211c366fFelipe Lemeimport android.annotation.TestApi;
21cd2969c85de5214375de9911c07c205c211c366fFelipe Lemeimport android.os.Parcelable;
22cd2969c85de5214375de9911c07c205c211c366fFelipe Lemeimport android.view.autofill.AutofillValue;
23cd2969c85de5214375de9911c07c205c211c366fFelipe Leme
24cd2969c85de5214375de9911c07c205c211c366fFelipe Leme/**
25cd2969c85de5214375de9911c07c205c211c366fFelipe Leme * Superclass of all sanitizers the system understands. As this is not public all public subclasses
26cd2969c85de5214375de9911c07c205c211c366fFelipe Leme * have to implement {@link Sanitizer} again.
27cd2969c85de5214375de9911c07c205c211c366fFelipe Leme *
28cd2969c85de5214375de9911c07c205c211c366fFelipe Leme * @hide
29cd2969c85de5214375de9911c07c205c211c366fFelipe Leme */
30cd2969c85de5214375de9911c07c205c211c366fFelipe Leme@TestApi
31cd2969c85de5214375de9911c07c205c211c366fFelipe Lemepublic abstract class InternalSanitizer implements Sanitizer, Parcelable {
32cd2969c85de5214375de9911c07c205c211c366fFelipe Leme
33cd2969c85de5214375de9911c07c205c211c366fFelipe Leme    /**
34cd2969c85de5214375de9911c07c205c211c366fFelipe Leme     * Sanitizes an {@link AutofillValue}.
35cd2969c85de5214375de9911c07c205c211c366fFelipe Leme     *
36f5059c39cbf72603c6a28ae9337041ddce5d4899Felipe Leme     * @return sanitized value or {@code null} if value could not be sanitized (for example: didn't
37f5059c39cbf72603c6a28ae9337041ddce5d4899Felipe Leme     * match regex, it's an invalid type, regex failed, etc).
38f5059c39cbf72603c6a28ae9337041ddce5d4899Felipe Leme     *
39cd2969c85de5214375de9911c07c205c211c366fFelipe Leme     * @hide
40cd2969c85de5214375de9911c07c205c211c366fFelipe Leme     */
41f5059c39cbf72603c6a28ae9337041ddce5d4899Felipe Leme    @Nullable
42cd2969c85de5214375de9911c07c205c211c366fFelipe Leme    public abstract AutofillValue sanitize(@NonNull AutofillValue value);
43cd2969c85de5214375de9911c07c205c211c366fFelipe Leme}
44