1 /* 2 * Copyright 2018 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 androidx.work.impl; 18 19 import android.net.Network; 20 import android.net.Uri; 21 import android.support.annotation.NonNull; 22 import android.support.annotation.Nullable; 23 import android.support.annotation.RequiresApi; 24 import android.support.annotation.RestrictTo; 25 26 import androidx.work.Data; 27 28 import java.util.HashSet; 29 import java.util.List; 30 import java.util.Set; 31 32 /** 33 * Extra information to setup Workers. 34 * 35 * @hide 36 */ 37 @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) 38 public class Extras { 39 40 private @NonNull Data mInputData; 41 private @NonNull Set<String> mTags; 42 private @Nullable RuntimeExtras mRuntimeExtras; 43 private int mRunAttemptCount; 44 Extras(@onNull Data inputData, @NonNull List<String> tags, @Nullable RuntimeExtras runtimeExtras, int runAttemptCount)45 public Extras(@NonNull Data inputData, 46 @NonNull List<String> tags, 47 @Nullable RuntimeExtras runtimeExtras, 48 int runAttemptCount) { 49 mInputData = inputData; 50 mTags = new HashSet<>(tags); 51 mRuntimeExtras = runtimeExtras; 52 mRunAttemptCount = runAttemptCount; 53 } 54 getInputData()55 public @NonNull Data getInputData() { 56 return mInputData; 57 } 58 getTags()59 public @NonNull Set<String> getTags() { 60 return mTags; 61 } 62 getRuntimeExtras()63 public @Nullable RuntimeExtras getRuntimeExtras() { 64 return mRuntimeExtras; 65 } 66 getRunAttemptCount()67 public int getRunAttemptCount() { 68 return mRunAttemptCount; 69 } 70 71 /** 72 * Extra runtime information for Workers. 73 * 74 * @hide 75 */ 76 @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) 77 public static class RuntimeExtras { 78 79 public String[] triggeredContentAuthorities; 80 public Uri[] triggeredContentUris; 81 82 @RequiresApi(28) 83 public Network network; 84 } 85 } 86