1 /* 2 * Copyright (C) 2023 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 android.tools.traces.inputmethod 18 19 /** 20 * Represents the InsetsProto in IME traces 21 * 22 * This is a generic object that is reused by both Flicker and Winscope and cannot access internal 23 * Java/Android functionality 24 */ 25 open class Insets( 26 val contentTopInsets: Int, 27 val visibleTopInsets: Int, 28 val touchableInsets: Int, 29 val touchableRegion: Int, 30 ) { toStringnull31 override fun toString(): String { 32 return "${this::class.simpleName}: {contentTopInsets: $contentTopInsets," + 33 "visibleTopInsets: $visibleTopInsets, touchableInsets: $touchableInsets," + 34 "touchableRegion: $touchableRegion" 35 } 36 equalsnull37 override fun equals(other: Any?): Boolean { 38 if (this === other) return true 39 if (other !is Insets) return false 40 41 if (contentTopInsets != other.contentTopInsets) return false 42 if (visibleTopInsets != other.visibleTopInsets) return false 43 if (touchableInsets != other.touchableInsets) return false 44 if (touchableRegion != other.touchableRegion) return false 45 46 return true 47 } 48 hashCodenull49 override fun hashCode(): Int { 50 var result = contentTopInsets 51 result = 31 * result + visibleTopInsets 52 result = 31 * result + touchableInsets 53 result = 31 * result + touchableRegion 54 return result 55 } 56 } 57