Change-Id: I5ba86c57983ff709a03de35736f73dbc83187dd3lineage-19.1
parent
26a35008ef
commit
cbd37647a7
@ -0,0 +1,87 @@ |
||||
// |
||||
// Copyright (C) 2022 StatiXOS |
||||
// |
||||
// 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 { |
||||
default_applicable_licenses: ["Android-Apache-2.0"], |
||||
} |
||||
|
||||
filegroup { |
||||
name: "ThemePickerGoogle_srcs", |
||||
srcs: [ |
||||
"src/**/*.java", |
||||
"src/**/*.kt", |
||||
], |
||||
} |
||||
|
||||
filegroup { |
||||
name: "ThemePickerGoogle_Manifest", |
||||
srcs: [ |
||||
"AndroidManifest.xml", |
||||
], |
||||
} |
||||
|
||||
genrule { |
||||
name: "ThemePickerGoogle_res", |
||||
tools: ["soong_zip"], |
||||
srcs: [ |
||||
"res/**/*" |
||||
], |
||||
out: ["ThemePickerGoogle_res.zip"], |
||||
cmd: "INPUTS=($(in)) && " |
||||
+ "RES_DIR=$$(dirname $$(dirname $${INPUTS[0]})) && " |
||||
+ "$(location soong_zip) -o $(out) -C $$RES_DIR -D $$RES_DIR" |
||||
} |
||||
|
||||
// |
||||
// Build app code. |
||||
// |
||||
android_app { |
||||
name: "ThemePickerGoogle", |
||||
|
||||
static_libs: [ |
||||
"wallpaper-common-deps", |
||||
"SettingsLibSettingsTheme", |
||||
"SystemUI-statsd", |
||||
"styleprotoslite", |
||||
], |
||||
|
||||
srcs: [ |
||||
":WallpaperPicker2_srcs", |
||||
":ThemePicker_srcs", |
||||
":ThemePickerGoogle_srcs", |
||||
"src_override/**/*.java", |
||||
"src_override/**/*.kt", |
||||
], |
||||
|
||||
use_embedded_native_libs: true, |
||||
|
||||
resource_zips: [":WallpaperPicker2_res", ":ThemePicker_res", ":ThemePickerGoogle_res"], |
||||
|
||||
optimize: { |
||||
enabled: false, |
||||
}, |
||||
kotlincflags: ["-Xjvm-default=enable"], |
||||
certificate: "platform", |
||||
|
||||
privileged: true, |
||||
system_ext_specific: true, |
||||
platform_apis: true, |
||||
manifest: "AndroidManifest.xml", |
||||
additional_manifests: [":WallpaperPicker2_Manifest", ":ThemePicker_Manifest"], |
||||
|
||||
overrides: ["ThemePicker", "WallpaperPicker2", "WallpaperPicker"], |
||||
} |
@ -0,0 +1,40 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" |
||||
xmlns:tools="http://schemas.android.com/tools" |
||||
package="com.android.wallpaper"> |
||||
|
||||
<uses-sdk android:targetSdkVersion="32" android:minSdkVersion="28"/> |
||||
|
||||
<application |
||||
tools:replace="android:name" |
||||
android:extractNativeLibs="false" |
||||
android:hardwareAccelerated="true" |
||||
android:label="@string/app_name" |
||||
android:requiredForAllUsers="true" |
||||
android:restoreAnyVersion="true" |
||||
android:supportsRtl="true" |
||||
android:name="com.google.android.customization.picker.GoogleCustomizationPickerApplication" |
||||
android:theme="@style/CustomizationTheme"> |
||||
<activity |
||||
tools:node="replace" |
||||
android:name="com.android.wallpaper.picker.CustomizationPickerActivity" |
||||
android:label="@string/app_name" |
||||
android:relinquishTaskIdentity="true" |
||||
android:resizeableActivity="false" |
||||
android:theme="@style/CustomizationTheme.NoActionBar" |
||||
android:exported="false"/> |
||||
|
||||
<activity-alias |
||||
android:name="com.google.android.customization.picker.GoogleCustomizationPickerActivity" |
||||
android:targetActivity="com.android.wallpaper.picker.CustomizationPickerActivity" |
||||
android:label="@string/app_name" |
||||
android:exported="true"> |
||||
<intent-filter> |
||||
<action android:name="android.intent.action.SET_WALLPAPER"/> |
||||
<category android:name="android.intent.category.DEFAULT"/> |
||||
</intent-filter> |
||||
</activity-alias> |
||||
|
||||
</application> |
||||
|
||||
</manifest> |
@ -0,0 +1,21 @@ |
||||
<!-- |
||||
Copyright (C) 2022 StatiXOS |
||||
|
||||
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. |
||||
--> |
||||
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> |
||||
<!-- The name of this application, a theme picker. [CHAR LIMIT=50] --> |
||||
<string name="app_name">Custom Themes & Styles</string> |
||||
|
||||
</resources> |
@ -0,0 +1,5 @@ |
||||
package com.google.android.customization.module |
||||
|
||||
import com.android.customization.module.DefaultCustomizationInjector |
||||
|
||||
public class GoogleCustomizationInjector : DefaultCustomizationInjector() |
@ -0,0 +1,17 @@ |
||||
package com.google.android.customization.picker |
||||
|
||||
import android.app.Application; |
||||
|
||||
import com.android.wallpaper.module.InjectorProvider; |
||||
|
||||
import com.google.android.customization.module.GoogleCustomizationInjector; |
||||
|
||||
public class GoogleCustomizationPickerApplication : Application() { |
||||
|
||||
override fun onCreate() { |
||||
super.onCreate() |
||||
|
||||
InjectorProvider.setInjector(GoogleCustomizationInjector()); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,18 @@ |
||||
/* |
||||
* 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.wallpaper.config |
||||
|
||||
internal class Flags : BaseFlags() |
@ -0,0 +1,112 @@ |
||||
/* |
||||
* 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.wallpaper.module; |
||||
|
||||
import android.content.Context; |
||||
import android.content.Intent; |
||||
import android.net.Uri; |
||||
|
||||
import androidx.fragment.app.Fragment; |
||||
|
||||
import com.android.wallpaper.model.CategoryProvider; |
||||
import com.android.wallpaper.model.WallpaperInfo; |
||||
import com.android.wallpaper.monitor.PerformanceMonitor; |
||||
import com.android.wallpaper.picker.ImagePreviewFragment; |
||||
import com.android.wallpaper.picker.TopLevelPickerActivity; |
||||
|
||||
/** |
||||
* A concrete, real implementation of the dependency provider. |
||||
*/ |
||||
public class WallpapersInjector extends BaseWallpaperInjector { |
||||
private CategoryProvider mCategoryProvider; |
||||
private UserEventLogger mUserEventLogger; |
||||
private WallpaperRotationRefresher mWallpaperRotationRefresher; |
||||
private PerformanceMonitor mPerformanceMonitor; |
||||
|
||||
@Override |
||||
public synchronized CategoryProvider getCategoryProvider(Context context) { |
||||
if (mCategoryProvider == null) { |
||||
mCategoryProvider = new DefaultCategoryProvider(context.getApplicationContext()); |
||||
} |
||||
return mCategoryProvider; |
||||
} |
||||
|
||||
@Override |
||||
public synchronized UserEventLogger getUserEventLogger(Context context) { |
||||
if (mUserEventLogger == null) { |
||||
mUserEventLogger = new NoOpUserEventLogger(); |
||||
} |
||||
return mUserEventLogger; |
||||
} |
||||
|
||||
@Override |
||||
public synchronized WallpaperRotationRefresher getWallpaperRotationRefresher() { |
||||
if (mWallpaperRotationRefresher == null) { |
||||
mWallpaperRotationRefresher = new WallpaperRotationRefresher() { |
||||
@Override |
||||
public void refreshWallpaper(Context context, Listener listener) { |
||||
// Not implemented
|
||||
listener.onError(); |
||||
} |
||||
}; |
||||
} |
||||
return mWallpaperRotationRefresher; |
||||
} |
||||
|
||||
@Override |
||||
public Fragment getPreviewFragment( |
||||
Context context, |
||||
WallpaperInfo wallpaperInfo, |
||||
int mode, |
||||
boolean viewAsHome, |
||||
boolean viewFullScreen, |
||||
boolean testingModeEnabled) { |
||||
return ImagePreviewFragment.newInstance(wallpaperInfo, mode, viewAsHome, viewFullScreen, |
||||
testingModeEnabled); |
||||
} |
||||
|
||||
@Override |
||||
public Intent getDeepLinkRedirectIntent(Context context, Uri uri) { |
||||
Intent intent = new Intent(); |
||||
intent.setClass(context, TopLevelPickerActivity.class); |
||||
intent.setData(uri); |
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); |
||||
return intent; |
||||
} |
||||
|
||||
@Override |
||||
public synchronized PerformanceMonitor getPerformanceMonitor() { |
||||
if (mPerformanceMonitor == null) { |
||||
mPerformanceMonitor = new PerformanceMonitor() { |
||||
@Override |
||||
public void recordFullResPreviewLoadedMemorySnapshot() { |
||||
// No Op
|
||||
} |
||||
}; |
||||
} |
||||
return mPerformanceMonitor; |
||||
} |
||||
|
||||
@Override |
||||
public synchronized LoggingOptInStatusProvider getLoggingOptInStatusProvider(Context context) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public String getDownloadableIntentAction() { |
||||
return null; |
||||
} |
||||
} |
Loading…
Reference in new issue