Skip to content

Commit

Permalink
sm8150-common: Add DisplayMode
Browse files Browse the repository at this point in the history
* partial import from https://github.com/yaap/device_oneplus_sm8150-common/tree/6b201009dea471d0e7ff042cba9a5d4087f4bc8a/DeviceSettings

Co-authored-by: darkobas <[email protected]>
Co-authored-by: Max Weninger <[email protected]>
Co-authored-by: Vachounet <[email protected]>
Co-authored-by: kldoc <[email protected]>
Co-authored-by: Christian Oder <[email protected]>
Co-authored-by: Josh Fox (XlxFoXxlX) <[email protected]>
Co-authored-by: David Sn <[email protected]>
Co-authored-by: Anirudh Gupta <[email protected]>
Co-authored-by: mTresk <[email protected]>
Co-authored-by: Ido Ben-Hur <[email protected]>
Co-authored-by: Anushek Prasal <[email protected]>
Signed-off-by: Omkar Chandorkar <[email protected]>
  • Loading branch information
12 people committed Mar 3, 2022
1 parent 60d6834 commit 865e792
Show file tree
Hide file tree
Showing 36 changed files with 1,739 additions and 0 deletions.
41 changes: 41 additions & 0 deletions DisplayMode/Android.bp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//
// Copyright (C) 2013 The CyanogenMod Project
// Copyright (C) 2017 The LineageOS 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.
//
android_app {
name: "DisplayMode",

defaults: [
"SettingsLibDefaults",
],

srcs: ["src/**/*.java"],
certificate: "platform",
platform_apis: true,
system_ext_specific: true,
privileged: true,

static_libs: [
"androidx.core_core",
"androidx.preference_preference",
],

resource_dirs: ["res"],

optimize: {
proguard_flags_files: ["proguard.flags"],
},

}
95 changes: 95 additions & 0 deletions DisplayMode/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2014-2015 The CyanogenMod Project
Copyright (C) 2017 The LineageOS 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.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:sharedUserId="android.uid.system"
package="co.aospa.settings.DisplayMode"
android:versionCode="1"
android:versionName="1.0" >

<uses-permission android:name="android.permission.INJECT_EVENTS"/>

<uses-sdk
android:minSdkVersion="28"
android:targetSdkVersion="29" />

<application
android:icon="@drawable/ic_panel_tile"
android:label="@string/display_title"
android:theme="@style/Theme.SubSettingsBase">

<!-- Device Settings -->
<activity
android:name=".DeviceSettingsActivity"
android:label="@string/display_title">
<intent-filter>
<action android:name="com.android.settings.action.EXTRA_SETTINGS" />
</intent-filter>
<intent-filter>
<action android:name="android.service.quicksettings.action.QS_TILE_PREFERENCES" />
</intent-filter>
<meta-data
android:name="com.android.settings.category"
android:value="com.android.settings.category.ia.display" />
<meta-data android:name="com.android.settings.summary"
android:resource="@string/display_summary" />
<meta-data
android:name="com.android.settings.order"
android:value="30" />
</activity>

<activity android:name=".DeviceSettings" />

<activity
android:name="co.aospa.settings.DisplayMode.PanelSettingsActivity"
android:exported="true"
android:label="@string/panel_category_title"
android:launchMode="singleTask" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>

<receiver android:name="co.aospa.settings.DisplayMode.Startup" >
<intent-filter android:priority="100" >
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>

<!-- Quick Settings Tiles -->
<service
android:name="co.aospa.settings.DisplayMode.PanelModeTileService"
android:icon="@drawable/ic_panel_tile"
android:label="@string/tile_panel_mode"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
<intent-filter>
<action
android:name="android.service.quicksettings.action.QS_TILE"/>
</intent-filter>
</service>
<service
android:name="co.aospa.settings.DisplayMode.HBMModeTileService"
android:icon="@drawable/ic_hbm_tile"
android:label="@string/tile_hbm_mode"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
<intent-filter>
<action
android:name="android.service.quicksettings.action.QS_TILE"/>
</intent-filter>
</service>
<service android:name="co.aospa.settings.DisplayMode.HBMModeService"
android:exported="false" />
</application>
</manifest>
3 changes: 3 additions & 0 deletions DisplayMode/proguard.flags
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-keep class co.aospa.settings.DisplayMode.* {
*;
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions DisplayMode/res/drawable/ic_color_arrow_left_lt.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2021 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.
-->

<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M0,0h24v24h-24z"/>
<path
android:pathData="M16.41,18.59L15,20L7,12L15,4L16.41,5.41L9.83,12"
android:fillColor="?android:attr/colorAccent"
android:fillType="evenOdd"/>
</vector>
29 changes: 29 additions & 0 deletions DisplayMode/res/drawable/ic_color_arrow_right_lt.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2021 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.
-->

<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M0,0h24v24h-24z"/>
<path
android:pathData="M7.59,5.41L9,4L17,12L9,20L7.59,18.59L14.17,12"
android:fillColor="?android:attr/colorAccent"
android:fillType="evenOdd"/>
</vector>
27 changes: 27 additions & 0 deletions DisplayMode/res/drawable/ic_color_page_indicator_focused.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2021 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.
-->

<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="6dp"
android:height="6dp"
android:viewportWidth="6"
android:viewportHeight="6">
<path
android:pathData="M3,0C4.65686,0 6,1.34315 6,3C6,4.65686 4.65685,6 3,6C1.34315,6 0,4.65685 0,3C0,1.34315 1.34315,0 3,0Z"
android:fillColor="?android:attr/colorAccent"
android:fillType="evenOdd"/>
</vector>
28 changes: 28 additions & 0 deletions DisplayMode/res/drawable/ic_color_page_indicator_unfocused.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2021 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.
-->

<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="6dp"
android:height="6dp"
android:viewportWidth="6"
android:viewportHeight="6">
<path
android:pathData="M3,0C4.65686,0 6,1.34315 6,3C6,4.65686 4.65685,6 3,6C1.34315,6 0,4.65685 0,3C0,1.34315 1.34315,0 3,0Z"
android:fillColor="?android:attr/colorAccent"
android:fillAlpha="0.24"
android:fillType="evenOdd"/>
</vector>
7 changes: 7 additions & 0 deletions DisplayMode/res/drawable/ic_hbm_tile.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="#fff" android:pathData="M7,17H4C2.38,17 0.96,15.74 0.76,14.14L0.26,11.15C0.15,10.3 0.39,9.5 0.91,8.92C1.43,8.34 2.19,8 3,8H9C9.83,8 10.58,8.35 11.06,8.96C11.17,9.11 11.27,9.27 11.35,9.45C11.78,9.36 12.22,9.36 12.64,9.45C12.72,9.27 12.82,9.11 12.94,8.96C13.41,8.35 14.16,8 15,8H21C21.81,8 22.57,8.34 23.09,8.92C23.6,9.5 23.84,10.3 23.74,11.11L23.23,14.18C23.04,15.74 21.61,17 20,17H17C15.44,17 13.92,15.81 13.54,14.3L12.64,11.59C12.26,11.31 11.73,11.31 11.35,11.59L10.43,14.37C10.07,15.82 8.56,17 7,17Z" />
</vector>
26 changes: 26 additions & 0 deletions DisplayMode/res/drawable/ic_info_outline_24dp.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
android:tint="?android:attr/textColorSecondary">
<path
android:fillColor="#000000"
android:pathData="M11,17h2v-6h-2v6zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8zM11,9h2L13,7h-2v2z"/>
</vector>
7 changes: 7 additions & 0 deletions DisplayMode/res/drawable/ic_panel_tile.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="#fff" android:pathData="M17.5,12A1.5,1.5 0 0,1 16,10.5A1.5,1.5 0 0,1 17.5,9A1.5,1.5 0 0,1 19,10.5A1.5,1.5 0 0,1 17.5,12M14.5,8A1.5,1.5 0 0,1 13,6.5A1.5,1.5 0 0,1 14.5,5A1.5,1.5 0 0,1 16,6.5A1.5,1.5 0 0,1 14.5,8M9.5,8A1.5,1.5 0 0,1 8,6.5A1.5,1.5 0 0,1 9.5,5A1.5,1.5 0 0,1 11,6.5A1.5,1.5 0 0,1 9.5,8M6.5,12A1.5,1.5 0 0,1 5,10.5A1.5,1.5 0 0,1 6.5,9A1.5,1.5 0 0,1 8,10.5A1.5,1.5 0 0,1 6.5,12M12,3A9,9 0 0,0 3,12A9,9 0 0,0 12,21A1.5,1.5 0 0,0 13.5,19.5C13.5,19.11 13.35,18.76 13.11,18.5C12.88,18.23 12.73,17.88 12.73,17.5A1.5,1.5 0 0,1 14.23,16H16A5,5 0 0,0 21,11C21,6.58 16.97,3 12,3Z" />
</vector>
39 changes: 39 additions & 0 deletions DisplayMode/res/layout/color_mode_view1.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2021 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.
-->

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:foregroundGravity="center_horizontal">

<ImageView
android:id="@+id/image1"
android:layout_width="match_parent"
android:layout_height="@dimen/color_mode_preview_height"
android:scaleType="centerCrop"
android:cropToPadding="true"
android:src="@drawable/color_mode_preview1"
android:contentDescription="@null" />

</FrameLayout>
</LinearLayout>
39 changes: 39 additions & 0 deletions DisplayMode/res/layout/color_mode_view2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2021 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.
-->

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:foregroundGravity="center_horizontal">

<ImageView
android:id="@+id/image2"
android:layout_width="match_parent"
android:layout_height="@dimen/color_mode_preview_height"
android:scaleType="centerCrop"
android:cropToPadding="true"
android:src="@drawable/color_mode_preview2"
android:contentDescription="@null" />

</FrameLayout>
</LinearLayout>
Loading

0 comments on commit 865e792

Please sign in to comment.