1 /* 2 * Copyright 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.os.cts.process.common; 17 18 import android.annotation.Nullable; 19 import android.content.Context; 20 import android.os.Parcelable; 21 import android.os.Process; 22 import android.os.SystemClock; 23 24 import com.android.internal.util.DataClass; 25 26 /** 27 * codegen ${ANDROID_BUILD_TOP}/cts/tests/process/src/android/os/cts/process/common/Message.java 28 */ 29 @DataClass( 30 genConstructor = false, 31 genSetters = false, 32 genToString = true, 33 genAidl = false) 34 public class Message implements Parcelable { Message()35 public Message() { 36 } 37 fillInBasicInfo(Context context)38 public void fillInBasicInfo(Context context) { 39 // codegen fails for whatever reason if it's after the fields. 40 packageName = context.getPackageName(); 41 processName = Process.myProcessName(); 42 43 applicationContextClassName = context.getApplicationContext().getClass().getCanonicalName(); 44 45 nowElapsedRealtime = SystemClock.elapsedRealtime(); 46 nowUptimeMillis = SystemClock.uptimeMillis(); 47 48 startElapsedRealtime = Process.getStartElapsedRealtime(); 49 startUptimeMillis = Process.getStartUptimeMillis(); 50 startRequestedElapsedRealtime = Process.getStartRequestedElapsedRealtime(); 51 startRequestedUptimeMillis = Process.getStartRequestedUptimeMillis(); 52 } 53 54 @Nullable 55 public String packageName; 56 @Nullable 57 public String applicationClassName; 58 @Nullable 59 public String receiverClassName; 60 @Nullable 61 public String applicationContextClassName; 62 @Nullable 63 public String processName; 64 public long startElapsedRealtime; 65 public long startUptimeMillis; 66 public long startRequestedElapsedRealtime; 67 public long startRequestedUptimeMillis; 68 public long nowElapsedRealtime; 69 public long nowUptimeMillis; 70 71 72 73 // Code below generated by codegen v1.0.23. 74 // 75 // DO NOT MODIFY! 76 // CHECKSTYLE:OFF Generated code 77 // 78 // To regenerate run: 79 // $ codegen $ANDROID_BUILD_TOP/cts/tests/process/src/android/os/cts/process/common/Message.java 80 // 81 // To exclude the generated code from IntelliJ auto-formatting enable (one-time): 82 // Settings > Editor > Code Style > Formatter Control 83 //@formatter:off 84 85 86 @Override 87 @DataClass.Generated.Member toString()88 public String toString() { 89 // You can override field toString logic by defining methods like: 90 // String fieldNameToString() { ... } 91 92 return "Message { " + 93 "packageName = " + packageName + ", " + 94 "applicationClassName = " + applicationClassName + ", " + 95 "receiverClassName = " + receiverClassName + ", " + 96 "applicationContextClassName = " + applicationContextClassName + ", " + 97 "processName = " + processName + ", " + 98 "startElapsedRealtime = " + startElapsedRealtime + ", " + 99 "startUptimeMillis = " + startUptimeMillis + ", " + 100 "startRequestedElapsedRealtime = " + startRequestedElapsedRealtime + ", " + 101 "startRequestedUptimeMillis = " + startRequestedUptimeMillis + ", " + 102 "nowElapsedRealtime = " + nowElapsedRealtime + ", " + 103 "nowUptimeMillis = " + nowUptimeMillis + 104 " }"; 105 } 106 107 @Override 108 @DataClass.Generated.Member writeToParcel(@ndroid.annotation.NonNull android.os.Parcel dest, int flags)109 public void writeToParcel(@android.annotation.NonNull android.os.Parcel dest, int flags) { 110 // You can override field parcelling by defining methods like: 111 // void parcelFieldName(Parcel dest, int flags) { ... } 112 113 int flg = 0; 114 if (packageName != null) flg |= 0x1; 115 if (applicationClassName != null) flg |= 0x2; 116 if (receiverClassName != null) flg |= 0x4; 117 if (applicationContextClassName != null) flg |= 0x8; 118 if (processName != null) flg |= 0x10; 119 dest.writeInt(flg); 120 if (packageName != null) dest.writeString(packageName); 121 if (applicationClassName != null) dest.writeString(applicationClassName); 122 if (receiverClassName != null) dest.writeString(receiverClassName); 123 if (applicationContextClassName != null) dest.writeString(applicationContextClassName); 124 if (processName != null) dest.writeString(processName); 125 dest.writeLong(startElapsedRealtime); 126 dest.writeLong(startUptimeMillis); 127 dest.writeLong(startRequestedElapsedRealtime); 128 dest.writeLong(startRequestedUptimeMillis); 129 dest.writeLong(nowElapsedRealtime); 130 dest.writeLong(nowUptimeMillis); 131 } 132 133 @Override 134 @DataClass.Generated.Member describeContents()135 public int describeContents() { return 0; } 136 137 /** @hide */ 138 @SuppressWarnings({"unchecked", "RedundantCast"}) 139 @DataClass.Generated.Member Message(@ndroid.annotation.NonNull android.os.Parcel in)140 protected Message(@android.annotation.NonNull android.os.Parcel in) { 141 // You can override field unparcelling by defining methods like: 142 // static FieldType unparcelFieldName(Parcel in) { ... } 143 144 int flg = in.readInt(); 145 String _packageName = (flg & 0x1) == 0 ? null : in.readString(); 146 String _applicationClassName = (flg & 0x2) == 0 ? null : in.readString(); 147 String _receiverClassName = (flg & 0x4) == 0 ? null : in.readString(); 148 String _applicationContextClassName = (flg & 0x8) == 0 ? null : in.readString(); 149 String _processName = (flg & 0x10) == 0 ? null : in.readString(); 150 long _startElapsedRealtime = in.readLong(); 151 long _startUptimeMillis = in.readLong(); 152 long _startRequestedElapsedRealtime = in.readLong(); 153 long _startRequestedUptimeMillis = in.readLong(); 154 long _nowElapsedRealtime = in.readLong(); 155 long _nowUptimeMillis = in.readLong(); 156 157 this.packageName = _packageName; 158 this.applicationClassName = _applicationClassName; 159 this.receiverClassName = _receiverClassName; 160 this.applicationContextClassName = _applicationContextClassName; 161 this.processName = _processName; 162 this.startElapsedRealtime = _startElapsedRealtime; 163 this.startUptimeMillis = _startUptimeMillis; 164 this.startRequestedElapsedRealtime = _startRequestedElapsedRealtime; 165 this.startRequestedUptimeMillis = _startRequestedUptimeMillis; 166 this.nowElapsedRealtime = _nowElapsedRealtime; 167 this.nowUptimeMillis = _nowUptimeMillis; 168 169 // onConstructed(); // You can define this method to get a callback 170 } 171 172 @DataClass.Generated.Member 173 public static final @android.annotation.NonNull Parcelable.Creator<Message> CREATOR 174 = new Parcelable.Creator<Message>() { 175 @Override 176 public Message[] newArray(int size) { 177 return new Message[size]; 178 } 179 180 @Override 181 public Message createFromParcel(@android.annotation.NonNull android.os.Parcel in) { 182 return new Message(in); 183 } 184 }; 185 186 @DataClass.Generated( 187 time = 1639154672715L, 188 codegenVersion = "1.0.23", 189 sourceFile = "cts/tests/process/src/android/os/cts/process/common/Message.java", 190 inputSignatures = "public @android.annotation.Nullable java.lang.String packageName\npublic @android.annotation.Nullable java.lang.String applicationClassName\npublic @android.annotation.Nullable java.lang.String receiverClassName\npublic @android.annotation.Nullable java.lang.String applicationContextClassName\npublic @android.annotation.Nullable java.lang.String processName\npublic long startElapsedRealtime\npublic long startUptimeMillis\npublic long startRequestedElapsedRealtime\npublic long startRequestedUptimeMillis\npublic long nowElapsedRealtime\npublic long nowUptimeMillis\npublic void fillInBasicInfo(android.content.Context)\nclass Message extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genConstructor=false, genSetters=false, genToString=true, genAidl=false)") 191 @Deprecated __metadata()192 private void __metadata() {} 193 194 195 //@formatter:on 196 // End of generated code 197 198 } 199