-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial support quickstep, Android versions from Q to U, ensuring a smooth and efficient user experience. Enjoy effortless navigation and swift app switching on your Android device with QuickSwitch's compatibility across the Q, R, S, T, and U. Co-authored-by: Goooler <[email protected]> Co-authored-by: 无言 <[email protected]>
- Loading branch information
1 parent
f63aa1e
commit c31b41a
Showing
111 changed files
with
4,548 additions
and
603 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Lawnchair Quickstep Compat Lib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
plugins { | ||
id 'com.android.library' | ||
} | ||
|
||
android { | ||
namespace "app.lawnchair.compatlib.ten" | ||
} | ||
|
||
addFrameworkJar('framework-10.jar') | ||
|
||
dependencies { | ||
implementation projects.compatLib | ||
implementation projects.compatLib.compatLibVR | ||
} |
123 changes: 123 additions & 0 deletions
123
compatLib/compatLibVQ/src/main/java/app/lawnchair/compatlib/ten/ActivityManagerCompatVQ.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
package app.lawnchair.compatlib.ten; | ||
|
||
import android.app.Activity; | ||
import android.app.ActivityManager; | ||
import android.app.ActivityTaskManager; | ||
import android.app.WindowConfiguration; | ||
import android.content.Intent; | ||
import android.graphics.Bitmap; | ||
import android.graphics.Rect; | ||
import android.os.RemoteException; | ||
import android.view.IRecentsAnimationController; | ||
import android.view.IRecentsAnimationRunner; | ||
import android.view.RemoteAnimationTarget; | ||
import app.lawnchair.compatlib.RecentsAnimationRunnerCompat; | ||
import app.lawnchair.compatlib.eleven.ActivityManagerCompatVR; | ||
import java.util.List; | ||
|
||
public class ActivityManagerCompatVQ extends ActivityManagerCompatVR { | ||
|
||
@Override | ||
public void invalidateHomeTaskSnapshot(Activity homeActivity) { | ||
// do nothing ,android Q not support | ||
} | ||
|
||
@Override | ||
public ActivityManager.RunningTaskInfo[] getRunningTasks(boolean filterOnlyVisibleRecents) { | ||
|
||
int ignoreActivityType = WindowConfiguration.ACTIVITY_TYPE_UNDEFINED; | ||
if (filterOnlyVisibleRecents) { | ||
ignoreActivityType = WindowConfiguration.ACTIVITY_TYPE_RECENTS; | ||
} | ||
|
||
try { | ||
|
||
List<ActivityManager.RunningTaskInfo> tasks = | ||
ActivityTaskManager.getService() | ||
.getFilteredTasks( | ||
NUM_RECENT_ACTIVITIES_REQUEST, | ||
ignoreActivityType, | ||
WindowConfiguration.WINDOWING_MODE_PINNED); | ||
if (tasks.isEmpty()) { | ||
return null; | ||
} | ||
return tasks.toArray(new ActivityManager.RunningTaskInfo[tasks.size()]); | ||
} catch (RemoteException e) { | ||
return null; | ||
} | ||
} | ||
|
||
@Override | ||
public void startRecentsActivity( | ||
Intent intent, long eventTime, RecentsAnimationRunnerCompat runnerCompat) { | ||
|
||
IRecentsAnimationRunner runner = null; | ||
if (runnerCompat != null) { | ||
runner = | ||
new IRecentsAnimationRunner.Stub() { | ||
@Override | ||
public void onAnimationStart( | ||
IRecentsAnimationController controller, | ||
RemoteAnimationTarget[] apps, | ||
Rect homeContentInsets, | ||
Rect minimizedHomeBounds) { | ||
runnerCompat.onAnimationStart( | ||
controller, apps, null, homeContentInsets, minimizedHomeBounds); | ||
} | ||
|
||
public void reportAllDrawn() {} | ||
|
||
@Override | ||
public void onAnimationCanceled(boolean deferredWithScreenshot) { | ||
runnerCompat.onAnimationCanceled(deferredWithScreenshot); | ||
} | ||
}; | ||
} | ||
try { | ||
ActivityTaskManager.getService().startRecentsActivity(intent, null, runner); | ||
} catch (RemoteException e) { | ||
|
||
} | ||
} | ||
|
||
@Override | ||
public ActivityManager.RunningTaskInfo getRunningTask(boolean filterOnlyVisibleRecents) { | ||
|
||
int ignoreActivityType = WindowConfiguration.ACTIVITY_TYPE_UNDEFINED; | ||
if (filterOnlyVisibleRecents) { | ||
ignoreActivityType = WindowConfiguration.ACTIVITY_TYPE_RECENTS; | ||
} | ||
try { | ||
List<ActivityManager.RunningTaskInfo> tasks = | ||
ActivityTaskManager.getService() | ||
.getFilteredTasks( | ||
1, | ||
ignoreActivityType, | ||
WindowConfiguration.WINDOWING_MODE_PINNED); | ||
if (tasks.isEmpty()) { | ||
return null; | ||
} | ||
return tasks.get(0); | ||
} catch (RemoteException e) { | ||
return null; | ||
} | ||
} | ||
|
||
@Override | ||
public ThumbnailData makeThumbnailData(ActivityManager.TaskSnapshot snapshot) { | ||
ThumbnailData data = new ThumbnailData(); | ||
data.thumbnail = | ||
Bitmap.wrapHardwareBuffer(snapshot.getSnapshot(), snapshot.getColorSpace()); | ||
data.insets = new Rect(snapshot.getContentInsets()); | ||
data.orientation = snapshot.getOrientation(); | ||
data.reducedResolution = snapshot.isReducedResolution(); | ||
// TODO(b/149579527): Pass task size instead of computing scale. | ||
// Assume width and height were scaled the same; compute scale only for width | ||
data.scale = snapshot.getScale(); | ||
data.isRealSnapshot = snapshot.isRealSnapshot(); | ||
data.isTranslucent = snapshot.isTranslucent(); | ||
data.windowingMode = snapshot.getWindowingMode(); | ||
data.systemUiVisibility = snapshot.getSystemUiVisibility(); | ||
return data; | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
compatLib/compatLibVQ/src/main/java/app/lawnchair/compatlib/ten/ActivityOptionsCompatVQ.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package app.lawnchair.compatlib.ten; | ||
|
||
import android.app.ActivityOptions; | ||
import android.content.Context; | ||
import android.os.Handler; | ||
import android.view.RemoteAnimationAdapter; | ||
import app.lawnchair.compatlib.ActivityOptionsCompat; | ||
|
||
public class ActivityOptionsCompatVQ extends ActivityOptionsCompat { | ||
@Override | ||
public ActivityOptions makeCustomAnimation( | ||
Context context, | ||
int enterResId, | ||
int exitResId, | ||
Runnable callback, | ||
Handler callbackHandler) { | ||
return ActivityOptions.makeCustomAnimation( | ||
context, | ||
enterResId, | ||
exitResId, | ||
callbackHandler, | ||
new ActivityOptions.OnAnimationStartedListener() { | ||
@Override | ||
public void onAnimationStarted() { | ||
if (callback != null) { | ||
callbackHandler.post(callback); | ||
} | ||
} | ||
}); | ||
} | ||
|
||
@Override | ||
public ActivityOptions makeRemoteAnimation( | ||
RemoteAnimationAdapter remoteAnimationAdapter, | ||
Object remoteTransition, | ||
String debugName) { | ||
return ActivityOptions.makeRemoteAnimation(remoteAnimationAdapter); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...atLib/compatLibVQ/src/main/java/app/lawnchair/compatlib/ten/QuickstepCompatFactoryVQ.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package app.lawnchair.compatlib.ten; | ||
|
||
import androidx.annotation.NonNull; | ||
import app.lawnchair.compatlib.ActivityManagerCompat; | ||
import app.lawnchair.compatlib.ActivityOptionsCompat; | ||
import app.lawnchair.compatlib.eleven.QuickstepCompatFactoryVR; | ||
|
||
public class QuickstepCompatFactoryVQ extends QuickstepCompatFactoryVR { | ||
|
||
@NonNull | ||
@Override | ||
public ActivityManagerCompat getActivityManagerCompat() { | ||
return new ActivityManagerCompatVQ(); | ||
} | ||
|
||
@NonNull | ||
@Override | ||
public ActivityOptionsCompat getActivityOptionsCompat() { | ||
return new ActivityOptionsCompatVQ(); | ||
} | ||
} |
File renamed without changes.
Oops, something went wrong.