| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.ui.base; | 5 package org.chromium.ui.base; |
| 6 | 6 |
| 7 import android.animation.Animator; | 7 import android.animation.Animator; |
| 8 import android.animation.AnimatorListenerAdapter; | 8 import android.animation.AnimatorListenerAdapter; |
| 9 import android.annotation.SuppressLint; | 9 import android.annotation.SuppressLint; |
| 10 import android.annotation.TargetApi; | 10 import android.annotation.TargetApi; |
| 11 import android.app.Activity; | 11 import android.app.Activity; |
| 12 import android.app.PendingIntent; | 12 import android.app.PendingIntent; |
| 13 import android.content.Context; | 13 import android.content.Context; |
| 14 import android.content.ContextWrapper; | 14 import android.content.ContextWrapper; |
| 15 import android.content.Intent; | 15 import android.content.Intent; |
| 16 import android.content.pm.PackageManager; | 16 import android.content.pm.PackageManager; |
| 17 import android.os.Build; | 17 import android.os.Build; |
| 18 import android.os.Bundle; | 18 import android.os.Bundle; |
| 19 import android.os.IBinder; | 19 import android.os.IBinder; |
| 20 import android.os.Process; | 20 import android.os.Process; |
| 21 import android.util.Log; | 21 import android.util.Log; |
| 22 import android.util.SparseArray; | 22 import android.util.SparseArray; |
| 23 import android.view.View; | 23 import android.view.View; |
| 24 import android.view.ViewGroup; | 24 import android.view.ViewGroup; |
| 25 import android.view.Window; | 25 import android.view.Window; |
| 26 import android.view.accessibility.AccessibilityManager; | 26 import android.view.accessibility.AccessibilityManager; |
| 27 | 27 |
| 28 import org.chromium.base.ApiCompatibilityUtils; | 28 import org.chromium.base.ApiCompatibilityUtils; |
| 29 import org.chromium.base.Callback; | 29 import org.chromium.base.Callback; |
| 30 import org.chromium.base.ContextUtils; |
| 30 import org.chromium.base.ObserverList; | 31 import org.chromium.base.ObserverList; |
| 31 import org.chromium.base.VisibleForTesting; | 32 import org.chromium.base.VisibleForTesting; |
| 32 import org.chromium.base.annotations.CalledByNative; | 33 import org.chromium.base.annotations.CalledByNative; |
| 33 import org.chromium.base.annotations.JNINamespace; | 34 import org.chromium.base.annotations.JNINamespace; |
| 34 import org.chromium.ui.VSyncMonitor; | 35 import org.chromium.ui.VSyncMonitor; |
| 35 import org.chromium.ui.display.DisplayAndroid; | 36 import org.chromium.ui.display.DisplayAndroid; |
| 36 import org.chromium.ui.widget.Toast; | 37 import org.chromium.ui.widget.Toast; |
| 37 | 38 |
| 38 import java.lang.ref.WeakReference; | 39 import java.lang.ref.WeakReference; |
| 39 import java.util.HashMap; | 40 import java.util.HashMap; |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 mContextRef = new WeakReference<>(context); | 207 mContextRef = new WeakReference<>(context); |
| 207 mOutstandingIntents = new SparseArray<>(); | 208 mOutstandingIntents = new SparseArray<>(); |
| 208 mIntentErrors = new HashMap<>(); | 209 mIntentErrors = new HashMap<>(); |
| 209 mVSyncMonitor = new VSyncMonitor(context, mVSyncListener); | 210 mVSyncMonitor = new VSyncMonitor(context, mVSyncListener); |
| 210 mAccessibilityManager = (AccessibilityManager) mApplicationContext.getSy
stemService( | 211 mAccessibilityManager = (AccessibilityManager) mApplicationContext.getSy
stemService( |
| 211 Context.ACCESSIBILITY_SERVICE); | 212 Context.ACCESSIBILITY_SERVICE); |
| 212 mDisplayAndroid = display; | 213 mDisplayAndroid = display; |
| 213 } | 214 } |
| 214 | 215 |
| 215 @CalledByNative | 216 @CalledByNative |
| 216 private static long createForTesting(Context context) { | 217 private static long createForTesting() { |
| 217 WindowAndroid windowAndroid = new WindowAndroid(context); | 218 WindowAndroid windowAndroid = new WindowAndroid(ContextUtils.getApplicat
ionContext()); |
| 218 // |windowAndroid.getNativePointer()| creates native WindowAndroid objec
t | 219 // |windowAndroid.getNativePointer()| creates native WindowAndroid objec
t |
| 219 // which stores a global ref to |windowAndroid|. Therefore |windowAndroi
d| | 220 // which stores a global ref to |windowAndroid|. Therefore |windowAndroi
d| |
| 220 // is not immediately eligible for gc. | 221 // is not immediately eligible for gc. |
| 221 return windowAndroid.getNativePointer(); | 222 return windowAndroid.getNativePointer(); |
| 222 } | 223 } |
| 223 | 224 |
| 224 @CalledByNative | 225 @CalledByNative |
| 225 private void clearNativePointer() { | 226 private void clearNativePointer() { |
| 226 mNativeWindowAndroid = 0; | 227 mNativeWindowAndroid = 0; |
| 227 } | 228 } |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 769 private native void nativeOnVSync(long nativeWindowAndroid, | 770 private native void nativeOnVSync(long nativeWindowAndroid, |
| 770 long vsyncTimeMicros, | 771 long vsyncTimeMicros, |
| 771 long vsyncPeriodMicros); | 772 long vsyncPeriodMicros); |
| 772 private native void nativeOnVisibilityChanged(long nativeWindowAndroid, bool
ean visible); | 773 private native void nativeOnVisibilityChanged(long nativeWindowAndroid, bool
ean visible); |
| 773 private native void nativeOnActivityStopped(long nativeWindowAndroid); | 774 private native void nativeOnActivityStopped(long nativeWindowAndroid); |
| 774 private native void nativeOnActivityStarted(long nativeWindowAndroid); | 775 private native void nativeOnActivityStarted(long nativeWindowAndroid); |
| 775 private native void nativeSetVSyncPaused(long nativeWindowAndroid, boolean p
aused); | 776 private native void nativeSetVSyncPaused(long nativeWindowAndroid, boolean p
aused); |
| 776 private native void nativeDestroy(long nativeWindowAndroid); | 777 private native void nativeDestroy(long nativeWindowAndroid); |
| 777 | 778 |
| 778 } | 779 } |
| OLD | NEW |