Loading core/java/android/view/CompositionSamplingListener.java +17 −5 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ import java.util.concurrent.Executor; */ public abstract class CompositionSamplingListener { private final long mNativeListener; private long mNativeListener; private final Executor mExecutor; public CompositionSamplingListener(Executor executor) { Loading @@ -37,13 +37,19 @@ public abstract class CompositionSamplingListener { mNativeListener = nativeCreate(this); } @Override protected void finalize() throws Throwable { try { if (mNativeListener != 0) { public void destroy() { if (mNativeListener == 0) { return; } unregister(this); nativeDestroy(mNativeListener); mNativeListener = 0; } @Override protected void finalize() throws Throwable { try { destroy(); } finally { super.finalize(); } Loading @@ -59,6 +65,9 @@ public abstract class CompositionSamplingListener { */ public static void register(CompositionSamplingListener listener, int displayId, IBinder stopLayer, Rect samplingArea) { if (listener.mNativeListener == 0) { return; } Preconditions.checkArgument(displayId == Display.DEFAULT_DISPLAY, "default display only for now"); nativeRegister(listener.mNativeListener, stopLayer, samplingArea.left, samplingArea.top, Loading @@ -69,6 +78,9 @@ public abstract class CompositionSamplingListener { * Unregisters a sampling listener. */ public static void unregister(CompositionSamplingListener listener) { if (listener.mNativeListener == 0) { return; } nativeUnregister(listener.mNativeListener); } Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NavBarTintController.java +6 −2 Original line number Diff line number Diff line Loading @@ -107,6 +107,11 @@ public class NavBarTintController implements View.OnAttachStateChangeListener, requestUpdateSamplingListener(); } void stopAndDestroy() { stop(); mSamplingListener.destroy(); } @Override public void onViewAttachedToWindow(View view) { requestUpdateSamplingListener(); Loading @@ -114,8 +119,7 @@ public class NavBarTintController implements View.OnAttachStateChangeListener, @Override public void onViewDetachedFromWindow(View view) { // Defer calling updateSamplingListener the attach info has not yet been reset requestUpdateSamplingListener(); stopAndDestroy(); } @Override Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java +3 −0 Original line number Diff line number Diff line Loading @@ -137,6 +137,7 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback private final MetricsLogger mMetricsLogger; private final DeviceProvisionedController mDeviceProvisionedController; private final StatusBarStateController mStatusBarStateController; private final NavigationModeController mNavigationModeController; protected NavigationBarView mNavigationBarView = null; Loading Loading @@ -253,6 +254,7 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback mAssistManager = assistManager; mAssistantAvailable = mAssistManager.getAssistInfoForUser(UserHandle.USER_CURRENT) != null; mOverviewProxyService = overviewProxyService; mNavigationModeController = navigationModeController; mNavBarMode = navigationModeController.addListener(this); } Loading Loading @@ -292,6 +294,7 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback @Override public void onDestroy() { super.onDestroy(); mNavigationModeController.removeListener(this); mAccessibilityManagerWrapper.removeCallback(mAccessibilityListener); mContentResolver.unregisterContentObserver(mMagnificationObserver); mContentResolver.unregisterContentObserver(mAssistContentObserver); Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/RegionSamplingHelper.java +6 −3 Original line number Diff line number Diff line Loading @@ -127,6 +127,11 @@ public class RegionSamplingHelper implements View.OnAttachStateChangeListener, updateSamplingListener(); } void stopAndDestroy() { stop(); mSamplingListener.destroy(); } @Override public void onViewAttachedToWindow(View view) { updateSamplingListener(); Loading @@ -134,9 +139,7 @@ public class RegionSamplingHelper implements View.OnAttachStateChangeListener, @Override public void onViewDetachedFromWindow(View view) { // isAttachedToWindow is only changed after this call to the listeners, so let's post it // instead postUpdateSamplingListener(); stopAndDestroy(); } @Override Loading Loading
core/java/android/view/CompositionSamplingListener.java +17 −5 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ import java.util.concurrent.Executor; */ public abstract class CompositionSamplingListener { private final long mNativeListener; private long mNativeListener; private final Executor mExecutor; public CompositionSamplingListener(Executor executor) { Loading @@ -37,13 +37,19 @@ public abstract class CompositionSamplingListener { mNativeListener = nativeCreate(this); } @Override protected void finalize() throws Throwable { try { if (mNativeListener != 0) { public void destroy() { if (mNativeListener == 0) { return; } unregister(this); nativeDestroy(mNativeListener); mNativeListener = 0; } @Override protected void finalize() throws Throwable { try { destroy(); } finally { super.finalize(); } Loading @@ -59,6 +65,9 @@ public abstract class CompositionSamplingListener { */ public static void register(CompositionSamplingListener listener, int displayId, IBinder stopLayer, Rect samplingArea) { if (listener.mNativeListener == 0) { return; } Preconditions.checkArgument(displayId == Display.DEFAULT_DISPLAY, "default display only for now"); nativeRegister(listener.mNativeListener, stopLayer, samplingArea.left, samplingArea.top, Loading @@ -69,6 +78,9 @@ public abstract class CompositionSamplingListener { * Unregisters a sampling listener. */ public static void unregister(CompositionSamplingListener listener) { if (listener.mNativeListener == 0) { return; } nativeUnregister(listener.mNativeListener); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NavBarTintController.java +6 −2 Original line number Diff line number Diff line Loading @@ -107,6 +107,11 @@ public class NavBarTintController implements View.OnAttachStateChangeListener, requestUpdateSamplingListener(); } void stopAndDestroy() { stop(); mSamplingListener.destroy(); } @Override public void onViewAttachedToWindow(View view) { requestUpdateSamplingListener(); Loading @@ -114,8 +119,7 @@ public class NavBarTintController implements View.OnAttachStateChangeListener, @Override public void onViewDetachedFromWindow(View view) { // Defer calling updateSamplingListener the attach info has not yet been reset requestUpdateSamplingListener(); stopAndDestroy(); } @Override Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java +3 −0 Original line number Diff line number Diff line Loading @@ -137,6 +137,7 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback private final MetricsLogger mMetricsLogger; private final DeviceProvisionedController mDeviceProvisionedController; private final StatusBarStateController mStatusBarStateController; private final NavigationModeController mNavigationModeController; protected NavigationBarView mNavigationBarView = null; Loading Loading @@ -253,6 +254,7 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback mAssistManager = assistManager; mAssistantAvailable = mAssistManager.getAssistInfoForUser(UserHandle.USER_CURRENT) != null; mOverviewProxyService = overviewProxyService; mNavigationModeController = navigationModeController; mNavBarMode = navigationModeController.addListener(this); } Loading Loading @@ -292,6 +294,7 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback @Override public void onDestroy() { super.onDestroy(); mNavigationModeController.removeListener(this); mAccessibilityManagerWrapper.removeCallback(mAccessibilityListener); mContentResolver.unregisterContentObserver(mMagnificationObserver); mContentResolver.unregisterContentObserver(mAssistContentObserver); Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/RegionSamplingHelper.java +6 −3 Original line number Diff line number Diff line Loading @@ -127,6 +127,11 @@ public class RegionSamplingHelper implements View.OnAttachStateChangeListener, updateSamplingListener(); } void stopAndDestroy() { stop(); mSamplingListener.destroy(); } @Override public void onViewAttachedToWindow(View view) { updateSamplingListener(); Loading @@ -134,9 +139,7 @@ public class RegionSamplingHelper implements View.OnAttachStateChangeListener, @Override public void onViewDetachedFromWindow(View view) { // isAttachedToWindow is only changed after this call to the listeners, so let's post it // instead postUpdateSamplingListener(); stopAndDestroy(); } @Override Loading