• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 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 com.android.systemui.complication;
17 
18 /**
19  * A {@link ComplicationId} is a value to uniquely identify a complication during the current
20  * runtime and within a particular scope. Any guarantees beyond this will need to be enforced
21  * externally.
22  */
23 public class ComplicationId {
24     /**
25      * An associated factory for minting ids that are unique in for the factory's scope.
26      */
27     public static class Factory {
28         private int mNextId;
29 
getNextId()30         ComplicationId getNextId() {
31             return new ComplicationId(mNextId++);
32         }
33     }
34 
35     private int mId;
36 
ComplicationId(int id)37     private ComplicationId(int id) {
38         mId = id;
39     }
40 
41     @Override
toString()42     public String toString() {
43         return "ComplicationId{" + "mId=" + mId + "}";
44     }
45 }
46