Skip to content

Commit 895c8c5

Browse files
committed
添加launcher_client库代码,添加对应服务
1 parent d927ae9 commit 895c8c5

File tree

58 files changed

+2925
-21
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+2925
-21
lines changed

.gitignore

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@
33
.gradle/
44
.idea/
55
build/
6-
gradle/
7-
gradlew
8-
gradlew.bat
9-
local.properties
106
mxlibrary/mxlibrary.iml
117
mxtheme/mxtheme.iml
128
Launcher3-master.iml
139

10+
effectivecard/effectivecard.iml
11+
launcherclient/launcherclient.iml

build.gradle

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,9 @@ buildscript {
22
repositories {
33
jcenter()
44
google()
5-
maven {
6-
url 'https://maven.google.com'
7-
}
85
}
96
dependencies {
10-
classpath 'com.android.tools.build:gradle:3.5.2'
7+
classpath 'com.android.tools.build:gradle:3.6.1'
118
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.10'
129
}
1310
}
@@ -113,17 +110,14 @@ repositories {
113110
maven { url "../../../prebuilts/fullsdk-linux/extras/android/m2repository" }
114111
google()
115112
jcenter()
116-
maven {
117-
url 'https://maven.google.com'
118-
}
119113
}
120114

121115
dependencies {
122116
implementation 'androidx.appcompat:appcompat:1.1.0'
123117
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
124118
implementation 'androidx.dynamicanimation:dynamicanimation:1.0.0'
125119
implementation 'androidx.recyclerview:recyclerview:1.1.0'
126-
implementation 'androidx.preference:preference:1.1.0'
120+
implementation 'androidx.preference:preference:1.1.1'
127121
implementation 'com.google.protobuf.nano:protobuf-javanano:3.2.0rc2'
128122
quickstepImplementation fileTree(dir: "quickstep/libs", include: 'sysui_shared.jar')
129123
testImplementation 'junit:junit:4.12'
@@ -136,6 +130,7 @@ dependencies {
136130
androidTestImplementation 'androidx.annotation:annotation:1.1.0'
137131
implementation project(':mxlibrary')
138132
implementation project(':mxtheme')
133+
implementation project(':effectivecard')
139134
}
140135

141136
protobuf {

effectivecard/build.gradle

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
apply plugin: 'com.android.library'
2+
3+
android {
4+
compileSdkVersion 29
5+
buildToolsVersion "29.0.3"
6+
7+
defaultConfig {
8+
minSdkVersion 19
9+
targetSdkVersion 29
10+
versionCode 1
11+
versionName "1.0"
12+
13+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
14+
consumerProguardFiles 'consumer-rules.pro'
15+
}
16+
17+
buildTypes {
18+
release {
19+
minifyEnabled false
20+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
21+
}
22+
}
23+
24+
}
25+
26+
dependencies {
27+
implementation fileTree(dir: 'libs', include: ['*.jar'])
28+
29+
implementation 'androidx.appcompat:appcompat:1.1.0'
30+
testImplementation 'junit:junit:4.12'
31+
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
32+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
33+
}

effectivecard/consumer-rules.pro

Whitespace-only changes.
49.7 KB
Binary file not shown.

effectivecard/proguard-rules.pro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.codemx.effectivecard;
2+
3+
import android.content.Context;
4+
5+
import androidx.test.platform.app.InstrumentationRegistry;
6+
import androidx.test.ext.junit.runners.AndroidJUnit4;
7+
8+
import org.junit.Test;
9+
import org.junit.runner.RunWith;
10+
11+
import static org.junit.Assert.*;
12+
13+
/**
14+
* Instrumented test, which will execute on an Android device.
15+
*
16+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
17+
*/
18+
@RunWith(AndroidJUnit4.class)
19+
public class ExampleInstrumentedTest {
20+
@Test
21+
public void useAppContext() {
22+
// Context of the app under test.
23+
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
24+
25+
assertEquals("com.codemx.effectivecard.test", appContext.getPackageName());
26+
}
27+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="com.codemx.effectivecard">
3+
4+
<application>
5+
<service android:name=".CardService"
6+
android:process="com.codemx.effectivecard">
7+
<intent-filter>
8+
<action android:name="com.codemx.launcher3.WINDOW_OVERLAY" />
9+
</intent-filter>
10+
</service>
11+
</application>
12+
13+
</manifest>
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
package com.codemx.effectivecard;
2+
3+
import android.app.Service;
4+
import android.content.Intent;
5+
import android.os.IBinder;
6+
import android.os.RemoteException;
7+
import android.view.WindowManager;
8+
9+
import com.codemx.effectivecard.launcherclient.ILauncherOverlay;
10+
import com.codemx.effectivecard.launcherclient.ILauncherOverlayCallback;
11+
12+
/**
13+
* Created by yuchuan
14+
* DATE 2020/4/17
15+
* TIME 15:05
16+
*/
17+
public class CardService extends Service {
18+
19+
private ILauncherOverlay.Stub mStub;
20+
private WindowManager.LayoutParams mParams;
21+
private ILauncherOverlayCallback mCallback;
22+
23+
@Override
24+
public void onCreate() {
25+
super.onCreate();
26+
mStub = new CardBinder();
27+
}
28+
29+
@Override
30+
public IBinder onBind(Intent intent) {
31+
return mStub;
32+
}
33+
34+
private class CardBinder extends ILauncherOverlay.Stub {
35+
36+
@Override
37+
public void startScroll() throws RemoteException {
38+
39+
}
40+
41+
@Override
42+
public void onScroll(float progress) throws RemoteException {
43+
44+
}
45+
46+
@Override
47+
public void endScroll() throws RemoteException {
48+
49+
}
50+
51+
@Override
52+
public void windowAttached(WindowManager.LayoutParams layoutParams,
53+
ILauncherOverlayCallback overlayCallback, int flags) throws RemoteException {
54+
mParams = layoutParams;
55+
mCallback = overlayCallback;
56+
57+
}
58+
59+
@Override
60+
public void windowDetached(boolean isChangingConfigurations) throws RemoteException {
61+
62+
}
63+
64+
@Override
65+
public void closeOverlay(int flags) throws RemoteException {
66+
67+
}
68+
69+
@Override
70+
public void onPause() throws RemoteException {
71+
72+
}
73+
74+
@Override
75+
public void onResume() throws RemoteException {
76+
77+
}
78+
79+
@Override
80+
public void openOverlay(int flags) throws RemoteException {
81+
82+
}
83+
84+
@Override
85+
public void requestVoiceDetection(boolean start) throws RemoteException {
86+
87+
}
88+
89+
@Override
90+
public String getVoiceSearchLanguage() throws RemoteException {
91+
return null;
92+
}
93+
94+
@Override
95+
public boolean isVoiceDetectionRunning() throws RemoteException {
96+
return false;
97+
}
98+
99+
@Override
100+
public void enableScroll(boolean left, boolean right) throws RemoteException {
101+
102+
}
103+
104+
@Override
105+
public void enableTransparentWallpaper(boolean isTransparent) throws RemoteException {
106+
107+
}
108+
109+
@Override
110+
public void enableLoopWithOverlay(boolean enableLoop) throws RemoteException {
111+
112+
}
113+
}
114+
115+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package com.codemx.effectivecard;
2+
3+
import android.content.Context;
4+
import android.content.pm.PackageManager;
5+
import android.graphics.PixelFormat;
6+
import android.util.Log;
7+
import android.view.Gravity;
8+
import android.view.View;
9+
import android.view.WindowManager;
10+
11+
/**
12+
* Created by yuchuan
13+
* DATE 2020/4/17
14+
* TIME 16:03
15+
*/
16+
public class CardWindowManager {
17+
18+
Context mContext;
19+
WindowManager mWindowManager;
20+
WindowManager.LayoutParams mParams;
21+
View mContentView;
22+
23+
private void initApplicationWindow(Context context) {
24+
try{
25+
mContext = context.createPackageContext("chenchao.example.com.appclient", Context.CONTEXT_IGNORE_SECURITY);
26+
Log.i("chenchao","mContext =" +mContext.getApplicationInfo().toString());
27+
mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
28+
29+
mParams = new WindowManager.LayoutParams();
30+
mParams.packageName ="chenchao.example.com.appclient";
31+
mParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA;
32+
mParams.format = PixelFormat.RGBA_8888;
33+
mParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
34+
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
35+
mParams.gravity = Gravity.TOP | Gravity.LEFT;
36+
mParams.width = WindowManager.LayoutParams.MATCH_PARENT;
37+
mParams.height = WindowManager.LayoutParams.MATCH_PARENT;
38+
} catch (PackageManager.NameNotFoundException n){
39+
n.printStackTrace();
40+
}
41+
}
42+
43+
private void initView(){
44+
45+
}
46+
47+
private void showWindow(){
48+
mWindowManager.addView(mContentView, mParams);
49+
}
50+
private void hideWindow(){
51+
mWindowManager.removeView(mContentView);
52+
}
53+
54+
55+
}

0 commit comments

Comments
 (0)