1/ Remove some unused code from the shared lib
Bug: 219861883 Test: Builds/Presubmit Change-Id: I884392d2fcbfac6fd27c01f0077d4fb426a24d4a
This commit is contained in:
@@ -184,6 +184,7 @@ public final class ThreadedRenderer extends HardwareRenderer {
|
||||
*/
|
||||
public static final String DEBUG_FORCE_DARK = "debug.hwui.force_dark";
|
||||
|
||||
public static int EGL_CONTEXT_PRIORITY_REALTIME_NV = 0x3357;
|
||||
public static int EGL_CONTEXT_PRIORITY_HIGH_IMG = 0x3101;
|
||||
public static int EGL_CONTEXT_PRIORITY_MEDIUM_IMG = 0x3102;
|
||||
public static int EGL_CONTEXT_PRIORITY_LOW_IMG = 0x3103;
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.android.systemui.shared.recents.utilities;
|
||||
|
||||
import static android.os.Trace.TRACE_TAG_APP;
|
||||
|
||||
/**
|
||||
* Helper class for internal trace functions.
|
||||
*/
|
||||
public class AppTrace {
|
||||
|
||||
/**
|
||||
* Begins a new async trace section with the given {@param key} and {@param cookie}.
|
||||
*/
|
||||
public static void start(String key, int cookie) {
|
||||
android.os.Trace.asyncTraceBegin(TRACE_TAG_APP, key, cookie);
|
||||
}
|
||||
|
||||
/**
|
||||
* Begins a new async trace section with the given {@param key}.
|
||||
*/
|
||||
public static void start(String key) {
|
||||
android.os.Trace.asyncTraceBegin(TRACE_TAG_APP, key, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ends an existing async trace section with the given {@param key}.
|
||||
*/
|
||||
public static void end(String key) {
|
||||
android.os.Trace.asyncTraceEnd(TRACE_TAG_APP, key, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ends an existing async trace section with the given {@param key} and {@param cookie}.
|
||||
*/
|
||||
public static void end(String key, int cookie) {
|
||||
android.os.Trace.asyncTraceEnd(TRACE_TAG_APP, key, cookie);
|
||||
}
|
||||
|
||||
/**
|
||||
* Begins a new trace section with the given {@param key}. Can be nested.
|
||||
*/
|
||||
public static void beginSection(String key) {
|
||||
android.os.Trace.beginSection(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ends an existing trace section started in the last {@link #beginSection(String)}.
|
||||
*/
|
||||
public static void endSection() {
|
||||
android.os.Trace.endSection();
|
||||
}
|
||||
|
||||
/**
|
||||
* Traces a counter value.
|
||||
*/
|
||||
public static void count(String name, int count) {
|
||||
android.os.Trace.traceCounter(TRACE_TAG_APP, name, count);
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.android.systemui.shared.recents.utilities;
|
||||
|
||||
import android.animation.TypeEvaluator;
|
||||
import android.graphics.RectF;
|
||||
|
||||
/**
|
||||
* This evaluator can be used to perform type interpolation between <code>RectF</code> values.
|
||||
*/
|
||||
public class RectFEvaluator implements TypeEvaluator<RectF> {
|
||||
|
||||
private final RectF mRect = new RectF();
|
||||
|
||||
/**
|
||||
* This function returns the result of linearly interpolating the start and
|
||||
* end Rect values, with <code>fraction</code> representing the proportion
|
||||
* between the start and end values. The calculation is a simple parametric
|
||||
* calculation on each of the separate components in the Rect objects
|
||||
* (left, top, right, and bottom).
|
||||
*
|
||||
* <p>The object returned will be the <code>reuseRect</code> passed into the constructor.</p>
|
||||
*
|
||||
* @param fraction The fraction from the starting to the ending values
|
||||
* @param startValue The start Rect
|
||||
* @param endValue The end Rect
|
||||
* @return A linear interpolation between the start and end values, given the
|
||||
* <code>fraction</code> parameter.
|
||||
*/
|
||||
@Override
|
||||
public RectF evaluate(float fraction, RectF startValue, RectF endValue) {
|
||||
float left = startValue.left + ((endValue.left - startValue.left) * fraction);
|
||||
float top = startValue.top + ((endValue.top - startValue.top) * fraction);
|
||||
float right = startValue.right + ((endValue.right - startValue.right) * fraction);
|
||||
float bottom = startValue.bottom + ((endValue.bottom - startValue.bottom) * fraction);
|
||||
mRect.set(left, top, right, bottom);
|
||||
return mRect;
|
||||
}
|
||||
}
|
||||
@@ -42,31 +42,4 @@ public class ActivityCompat {
|
||||
public void unregisterRemoteAnimations() {
|
||||
mWrapped.unregisterRemoteAnimations();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see android.view.ViewDebug#dumpv2(View, ByteArrayOutputStream)
|
||||
*/
|
||||
public boolean encodeViewHierarchy(ByteArrayOutputStream out) {
|
||||
View view = null;
|
||||
if (mWrapped.getWindow() != null &&
|
||||
mWrapped.getWindow().peekDecorView() != null &&
|
||||
mWrapped.getWindow().peekDecorView().getViewRootImpl() != null) {
|
||||
view = mWrapped.getWindow().peekDecorView().getViewRootImpl().getView();
|
||||
}
|
||||
if (view == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final ViewHierarchyEncoder encoder = new ViewHierarchyEncoder(out);
|
||||
int[] location = view.getLocationOnScreen();
|
||||
encoder.addProperty("window:left", location[0]);
|
||||
encoder.addProperty("window:top", location[1]);
|
||||
view.encode(encoder);
|
||||
encoder.endStream();
|
||||
return true;
|
||||
}
|
||||
|
||||
public int getDisplayId() {
|
||||
return mWrapped.getDisplayId();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,7 +262,6 @@ public class ActivityManagerWrapper {
|
||||
* Starts a task from Recents synchronously.
|
||||
*/
|
||||
public boolean startActivityFromRecents(Task.TaskKey taskKey, ActivityOptions options) {
|
||||
ActivityOptionsCompat.addTaskInfo(options, taskKey);
|
||||
return startActivityFromRecents(taskKey.id, options);
|
||||
}
|
||||
|
||||
|
||||
@@ -104,15 +104,4 @@ public abstract class ActivityOptionsCompat {
|
||||
opts.setSourceInfo(ActivityOptions.SourceInfo.TYPE_LAUNCHER, uptimeMillis);
|
||||
return opts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Task specific information to the activity options
|
||||
*/
|
||||
public static void addTaskInfo(ActivityOptions opts, Task.TaskKey taskKey) {
|
||||
if (taskKey.windowingMode == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY) {
|
||||
// We show non-visible docked tasks in Recents, but we always want to launch
|
||||
// them in the fullscreen stack.
|
||||
opts.setLaunchWindowingMode(WINDOWING_MODE_SPLIT_SCREEN_SECONDARY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License
|
||||
*/
|
||||
|
||||
package com.android.systemui.shared.system;
|
||||
|
||||
import android.content.ClipDescription;
|
||||
import android.content.Intent;
|
||||
|
||||
/**
|
||||
* Wrapper around ClipDescription.
|
||||
*/
|
||||
public abstract class ClipDescriptionCompat {
|
||||
|
||||
public static String MIMETYPE_APPLICATION_ACTIVITY =
|
||||
ClipDescription.MIMETYPE_APPLICATION_ACTIVITY;
|
||||
|
||||
public static String MIMETYPE_APPLICATION_SHORTCUT =
|
||||
ClipDescription.MIMETYPE_APPLICATION_SHORTCUT;
|
||||
|
||||
public static String MIMETYPE_APPLICATION_TASK =
|
||||
ClipDescription.MIMETYPE_APPLICATION_TASK;
|
||||
|
||||
public static String EXTRA_PENDING_INTENT = ClipDescription.EXTRA_PENDING_INTENT;
|
||||
|
||||
public static String EXTRA_TASK_ID = Intent.EXTRA_TASK_ID;
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.android.systemui.shared.system;
|
||||
|
||||
import android.content.res.Configuration;
|
||||
|
||||
/**
|
||||
* Wraps the Configuration to access the window configuration.
|
||||
*/
|
||||
public class ConfigurationCompat {
|
||||
|
||||
public static int getWindowConfigurationRotation(Configuration c) {
|
||||
return c.windowConfiguration.getRotation();
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.systemui.shared.system;
|
||||
|
||||
import android.view.IDockedStackListener;
|
||||
|
||||
/**
|
||||
* An interface to track docked stack changes.
|
||||
*/
|
||||
public class DockedStackListenerCompat {
|
||||
|
||||
IDockedStackListener.Stub mListener = new IDockedStackListener.Stub() {
|
||||
@Override
|
||||
public void onDividerVisibilityChanged(boolean visible) {}
|
||||
|
||||
@Override
|
||||
public void onDockedStackExistsChanged(boolean exists) {
|
||||
DockedStackListenerCompat.this.onDockedStackExistsChanged(exists);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDockedStackMinimizedChanged(boolean minimized, long animDuration,
|
||||
boolean isHomeStackResizable) {
|
||||
DockedStackListenerCompat.this.onDockedStackMinimizedChanged(minimized, animDuration,
|
||||
isHomeStackResizable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdjustedForImeChanged(boolean adjustedForIme, long animDuration) {}
|
||||
|
||||
@Override
|
||||
public void onDockSideChanged(final int newDockSide) {
|
||||
DockedStackListenerCompat.this.onDockSideChanged(newDockSide);
|
||||
}
|
||||
};
|
||||
|
||||
public void onDockedStackExistsChanged(boolean exists) {
|
||||
// To be overridden
|
||||
}
|
||||
|
||||
public void onDockedStackMinimizedChanged(boolean minimized, long animDuration,
|
||||
boolean isHomeStackResizable) {
|
||||
// To be overridden
|
||||
}
|
||||
|
||||
public void onDockSideChanged(final int newDockSide) {
|
||||
// To be overridden
|
||||
}
|
||||
}
|
||||
@@ -24,14 +24,6 @@ import com.android.internal.util.LatencyTracker;
|
||||
* @see LatencyTracker
|
||||
*/
|
||||
public class LatencyTrackerCompat {
|
||||
/**
|
||||
* @see LatencyTracker
|
||||
* @deprecated Please use {@link LatencyTrackerCompat#logToggleRecents(Context, int)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public static void logToggleRecents(int duration) {
|
||||
LatencyTracker.logActionDeprecated(LatencyTracker.ACTION_TOGGLE_RECENTS, duration, false);
|
||||
}
|
||||
|
||||
/** @see LatencyTracker */
|
||||
public static void logToggleRecents(Context context, int duration) {
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License
|
||||
*/
|
||||
|
||||
package com.android.systemui.shared.system;
|
||||
|
||||
import android.app.PendingIntent;
|
||||
import android.content.ComponentName;
|
||||
import android.content.pm.LauncherApps;
|
||||
import android.os.Bundle;
|
||||
import android.os.UserHandle;
|
||||
|
||||
/**
|
||||
* Wrapper around LauncherApps.
|
||||
*/
|
||||
public abstract class LauncherAppsCompat {
|
||||
|
||||
public static PendingIntent getMainActivityLaunchIntent(LauncherApps launcherApps,
|
||||
ComponentName component, Bundle startActivityOptions, UserHandle user) {
|
||||
return launcherApps.getMainActivityLaunchIntent(component, startActivityOptions, user);
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License
|
||||
*/
|
||||
|
||||
package com.android.systemui.shared.system;
|
||||
|
||||
public class LauncherEventUtil {
|
||||
|
||||
// Constants for the Action
|
||||
public static final int VISIBLE = 0;
|
||||
public static final int DISMISS = 1;
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License
|
||||
*/
|
||||
|
||||
package com.android.systemui.shared.system;
|
||||
|
||||
import com.android.internal.logging.MetricsLogger;
|
||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
|
||||
public class MetricsLoggerCompat {
|
||||
|
||||
private final MetricsLogger mMetricsLogger;
|
||||
public static final int OVERVIEW_ACTIVITY = MetricsEvent.OVERVIEW_ACTIVITY;
|
||||
|
||||
public MetricsLoggerCompat() {
|
||||
mMetricsLogger = new MetricsLogger();
|
||||
}
|
||||
|
||||
public void action(int category) {
|
||||
mMetricsLogger.action(category);
|
||||
}
|
||||
|
||||
public void action(int category, int value) {
|
||||
mMetricsLogger.action(category, value);
|
||||
}
|
||||
|
||||
public void visible(int category) {
|
||||
mMetricsLogger.visible(category);
|
||||
}
|
||||
|
||||
public void hidden(int category) {
|
||||
mMetricsLogger.hidden(category);
|
||||
}
|
||||
|
||||
public void visibility(int category, boolean visible) {
|
||||
mMetricsLogger.visibility(category, visible);
|
||||
}
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.android.systemui.shared.system;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
import android.view.IRotationWatcher;
|
||||
import android.view.WindowManagerGlobal;
|
||||
|
||||
public abstract class RotationWatcher {
|
||||
|
||||
private static final String TAG = "RotationWatcher";
|
||||
|
||||
private final Context mContext;
|
||||
|
||||
private final IRotationWatcher mWatcher = new IRotationWatcher.Stub() {
|
||||
|
||||
@Override
|
||||
public void onRotationChanged(int rotation) {
|
||||
RotationWatcher.this.onRotationChanged(rotation);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
private boolean mIsWatching = false;
|
||||
|
||||
public RotationWatcher(Context context) {
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
protected abstract void onRotationChanged(int rotation);
|
||||
|
||||
public void enable() {
|
||||
if (!mIsWatching) {
|
||||
try {
|
||||
WindowManagerGlobal.getWindowManagerService().watchRotation(mWatcher,
|
||||
mContext.getDisplayId());
|
||||
mIsWatching = true;
|
||||
} catch (RemoteException e) {
|
||||
Log.w(TAG, "Failed to set rotation watcher", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void disable() {
|
||||
if (mIsWatching) {
|
||||
try {
|
||||
WindowManagerGlobal.getWindowManagerService().removeRotationWatcher(mWatcher);
|
||||
mIsWatching = false;
|
||||
} catch (RemoteException e) {
|
||||
Log.w(TAG, "Failed to remove rotation watcher", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License
|
||||
*/
|
||||
|
||||
package com.android.systemui.shared.system;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.graphics.Bitmap;
|
||||
|
||||
public class TaskDescriptionCompat {
|
||||
|
||||
private ActivityManager.TaskDescription mTaskDescription;
|
||||
|
||||
public TaskDescriptionCompat(ActivityManager.TaskDescription td) {
|
||||
mTaskDescription = td;
|
||||
}
|
||||
|
||||
public int getPrimaryColor() {
|
||||
return mTaskDescription != null
|
||||
? mTaskDescription.getPrimaryColor()
|
||||
: 0;
|
||||
}
|
||||
|
||||
public int getBackgroundColor() {
|
||||
return mTaskDescription != null
|
||||
? mTaskDescription.getBackgroundColor()
|
||||
: 0;
|
||||
}
|
||||
|
||||
public static Bitmap getIcon(ActivityManager.TaskDescription desc, int userId) {
|
||||
if (desc.getInMemoryIcon() != null) {
|
||||
return desc.getInMemoryIcon();
|
||||
}
|
||||
return ActivityManager.TaskDescription.loadTaskDescriptionIcon(
|
||||
desc.getIconFilename(), userId);
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License
|
||||
*/
|
||||
|
||||
package com.android.systemui.shared.system;
|
||||
|
||||
import android.view.ThreadedRenderer;
|
||||
|
||||
/**
|
||||
* @see ThreadedRenderer
|
||||
*/
|
||||
public class ThreadedRendererCompat {
|
||||
|
||||
public static int EGL_CONTEXT_PRIORITY_REALTIME_NV = 0x3357;
|
||||
public static int EGL_CONTEXT_PRIORITY_HIGH_IMG = 0x3101;
|
||||
public static int EGL_CONTEXT_PRIORITY_MEDIUM_IMG = 0x3102;
|
||||
public static int EGL_CONTEXT_PRIORITY_LOW_IMG = 0x3103;
|
||||
|
||||
public static void setContextPriority(int priority) {
|
||||
ThreadedRenderer.setContextPriority(priority);
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.android.systemui.shared.system;
|
||||
|
||||
import android.app.WallpaperColors;
|
||||
import android.content.Context;
|
||||
|
||||
import com.android.internal.colorextraction.ColorExtractor.GradientColors;
|
||||
import com.android.internal.colorextraction.types.Tonal;
|
||||
|
||||
public class TonalCompat {
|
||||
|
||||
private final Tonal mTonal;
|
||||
|
||||
public TonalCompat(Context context) {
|
||||
mTonal = new Tonal(context);
|
||||
}
|
||||
|
||||
public ExtractionInfo extractDarkColors(WallpaperColors colors) {
|
||||
GradientColors darkColors = new GradientColors();
|
||||
mTonal.extractInto(colors, new GradientColors(), darkColors, new GradientColors());
|
||||
|
||||
ExtractionInfo result = new ExtractionInfo();
|
||||
result.mainColor = darkColors.getMainColor();
|
||||
result.secondaryColor = darkColors.getSecondaryColor();
|
||||
result.supportsDarkText = darkColors.supportsDarkText();
|
||||
if (colors != null) {
|
||||
result.supportsDarkTheme =
|
||||
(colors.getColorHints() & WallpaperColors.HINT_SUPPORTS_DARK_THEME) != 0;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static class ExtractionInfo {
|
||||
public int mainColor;
|
||||
public int secondaryColor;
|
||||
public boolean supportsDarkText;
|
||||
public boolean supportsDarkTheme;
|
||||
}
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License
|
||||
*/
|
||||
package com.android.systemui.shared.system;
|
||||
|
||||
import android.graphics.HardwareRenderer;
|
||||
import android.view.SurfaceControl;
|
||||
import android.view.View;
|
||||
import android.view.ViewRootImpl;
|
||||
|
||||
import java.util.function.LongConsumer;
|
||||
|
||||
/**
|
||||
* Helper class to expose some ViewRoomImpl methods
|
||||
*/
|
||||
public class ViewRootImplCompat {
|
||||
|
||||
private final ViewRootImpl mViewRoot;
|
||||
|
||||
public ViewRootImplCompat(View view) {
|
||||
mViewRoot = view == null ? null : view.getViewRootImpl();
|
||||
}
|
||||
|
||||
public SurfaceControl getRenderSurfaceControl() {
|
||||
return mViewRoot == null ? null : mViewRoot.getSurfaceControl();
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return mViewRoot != null;
|
||||
}
|
||||
|
||||
public View getView() {
|
||||
return mViewRoot == null ? null : mViewRoot.getView();
|
||||
}
|
||||
|
||||
public void registerRtFrameCallback(LongConsumer callback) {
|
||||
if (mViewRoot != null) {
|
||||
mViewRoot.registerRtFrameCallback(
|
||||
new HardwareRenderer.FrameDrawingCallback() {
|
||||
@Override
|
||||
public void onFrameDraw(long l) {
|
||||
callback.accept(l);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void mergeWithNextTransaction(SurfaceControl.Transaction t, long frame) {
|
||||
if (mViewRoot != null) {
|
||||
mViewRoot.mergeWithNextTransaction(t, frame);
|
||||
} else {
|
||||
t.apply();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.android.systemui.shared.system;
|
||||
|
||||
import android.graphics.Rect;
|
||||
import android.service.wallpaper.IWallpaperEngine;
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
* @see IWallpaperEngine
|
||||
*/
|
||||
public class WallpaperEngineCompat {
|
||||
|
||||
private static final String TAG = "WallpaperEngineCompat";
|
||||
|
||||
/**
|
||||
* Returns true if {@link IWallpaperEngine#scalePreview(Rect)} is available.
|
||||
*/
|
||||
public static boolean supportsScalePreview() {
|
||||
try {
|
||||
return IWallpaperEngine.class.getMethod("scalePreview", Rect.class) != null;
|
||||
} catch (NoSuchMethodException | SecurityException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private final IWallpaperEngine mWrappedEngine;
|
||||
|
||||
public WallpaperEngineCompat(IWallpaperEngine wrappedEngine) {
|
||||
mWrappedEngine = wrappedEngine;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IWallpaperEngine#scalePreview(Rect)
|
||||
*/
|
||||
public void scalePreview(Rect scaleToRect) {
|
||||
try {
|
||||
mWrappedEngine.scalePreview(scaleToRect);
|
||||
} catch (Exception e) {
|
||||
Log.i(TAG, "Couldn't call scalePreview method on WallpaperEngine", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.systemui.shared.system;
|
||||
|
||||
import android.app.WallpaperManager;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.os.IBinder;
|
||||
|
||||
/**
|
||||
* @see WallpaperManager
|
||||
*/
|
||||
public class WallpaperManagerCompat {
|
||||
private final WallpaperManager mWallpaperManager;
|
||||
|
||||
public WallpaperManagerCompat(Context context) {
|
||||
mWallpaperManager = context.getSystemService(WallpaperManager.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see WallpaperManager#setWallpaperZoomOut(IBinder, float)
|
||||
*/
|
||||
public void setWallpaperZoomOut(IBinder windowToken, float zoom) {
|
||||
mWallpaperManager.setWallpaperZoomOut(windowToken, zoom);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the max scale for the wallpaper when it's fully zoomed out
|
||||
*/
|
||||
public static float getWallpaperZoomOutMaxScale(Context context) {
|
||||
return context.getResources()
|
||||
.getFloat(Resources.getSystem().getIdentifier(
|
||||
/* name= */ "config_wallpaperMaxScale",
|
||||
/* defType= */ "dimen",
|
||||
/* defPackage= */ "android"));
|
||||
}
|
||||
}
|
||||
@@ -38,13 +38,13 @@ import android.util.DumpableContainer;
|
||||
import android.util.Log;
|
||||
import android.util.TimingsTraceLog;
|
||||
import android.view.SurfaceControl;
|
||||
import android.view.ThreadedRenderer;
|
||||
|
||||
import com.android.internal.protolog.common.ProtoLog;
|
||||
import com.android.systemui.dagger.ContextComponentHelper;
|
||||
import com.android.systemui.dagger.GlobalRootComponent;
|
||||
import com.android.systemui.dagger.SysUIComponent;
|
||||
import com.android.systemui.dump.DumpManager;
|
||||
import com.android.systemui.shared.system.ThreadedRendererCompat;
|
||||
import com.android.systemui.util.NotificationChannels;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
@@ -118,11 +118,11 @@ public class SystemUIApplication extends Application implements
|
||||
// The priority is defaulted at medium.
|
||||
int sfPriority = SurfaceControl.getGPUContextPriority();
|
||||
Log.i(TAG, "Found SurfaceFlinger's GPU Priority: " + sfPriority);
|
||||
if (sfPriority == ThreadedRendererCompat.EGL_CONTEXT_PRIORITY_REALTIME_NV) {
|
||||
if (sfPriority == ThreadedRenderer.EGL_CONTEXT_PRIORITY_REALTIME_NV) {
|
||||
Log.i(TAG, "Setting SysUI's GPU Context priority to: "
|
||||
+ ThreadedRendererCompat.EGL_CONTEXT_PRIORITY_HIGH_IMG);
|
||||
ThreadedRendererCompat.setContextPriority(
|
||||
ThreadedRendererCompat.EGL_CONTEXT_PRIORITY_HIGH_IMG);
|
||||
+ ThreadedRenderer.EGL_CONTEXT_PRIORITY_HIGH_IMG);
|
||||
ThreadedRenderer.setContextPriority(
|
||||
ThreadedRenderer.EGL_CONTEXT_PRIORITY_HIGH_IMG);
|
||||
}
|
||||
|
||||
// Enable binder tracing on system server for calls originating from SysUI
|
||||
|
||||
Reference in New Issue
Block a user