• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 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.app;
17 
18 import android.annotation.NonNull;
19 import android.os.Parcel;
20 import android.os.Parcelable;
21 
22 /**
23  * Exception thrown when an app tries to start a background {@link Service} when it's not allowed to
24  * do so.
25  */
26 public final class BackgroundServiceStartNotAllowedException
27         extends ServiceStartNotAllowedException implements Parcelable {
28     /**
29      * Constructor.
30      */
BackgroundServiceStartNotAllowedException(@onNull String message)31     public BackgroundServiceStartNotAllowedException(@NonNull String message) {
32         super(message);
33     }
34 
BackgroundServiceStartNotAllowedException(@onNull Parcel source)35     BackgroundServiceStartNotAllowedException(@NonNull Parcel source) {
36         super(source.readString());
37     }
38 
39     @Override
describeContents()40     public int describeContents() {
41         return 0;
42     }
43 
44     @Override
writeToParcel(@onNull Parcel dest, int flags)45     public void writeToParcel(@NonNull Parcel dest, int flags) {
46         dest.writeString(getMessage());
47     }
48 
49     public static final @NonNull Creator<android.app.BackgroundServiceStartNotAllowedException>
50             CREATOR = new Creator<android.app.BackgroundServiceStartNotAllowedException>() {
51                 @NonNull
52                 public android.app.BackgroundServiceStartNotAllowedException createFromParcel(
53                         Parcel source) {
54                     return new android.app.BackgroundServiceStartNotAllowedException(source);
55                 }
56 
57                 @NonNull
58                 public android.app.BackgroundServiceStartNotAllowedException[] newArray(int size) {
59                     return new android.app.BackgroundServiceStartNotAllowedException[size];
60                 }
61             };
62 }
63