diff options
| author | Michael Bestas <mikeioannina@gmail.com> | 2014-07-08 18:23:11 +0300 |
|---|---|---|
| committer | LorDClockaN <davor@losinj.com> | 2014-07-16 14:23:53 +0200 |
| commit | ba908dedeb9092be6047c635a789737aaff7fef1 (patch) | |
| tree | 4ba1a16edb063279f521ea187a465f5163c2372d | |
| parent | fb3afc6d6b51dbda4a5d2f30f2e0c49c6afbf9e2 (diff) | |
Add option to force high-end graphics on low memory devices
Change-Id: Ie80dbf658d6ca4c4fb230482745029098fe6777d
| -rw-r--r-- | AndroidManifest.xml | 1 | ||||
| -rw-r--r-- | res/layout/fragment_general_settings.xml | 11 | ||||
| -rw-r--r-- | res/values/strings.xml | 4 | ||||
| -rw-r--r-- | src/com/aokp/romcontrol/fragments/GeneralSettingsFragment.java | 25 |
4 files changed, 38 insertions, 3 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index fe4b4a7..747a8a6 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.aokp.romcontrol" + android:sharedUserId="android.uid.system" android:versionCode="1" android:versionName="1.0"> diff --git a/res/layout/fragment_general_settings.xml b/res/layout/fragment_general_settings.xml index 9129765..1fc037e 100644 --- a/res/layout/fragment_general_settings.xml +++ b/res/layout/fragment_general_settings.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <!-- /** - * Copyright (c) 2013, The Android Open Kang Project + * Copyright (c) 2013-2014, The Android Open Kang Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,4 +39,13 @@ android:key="wakeup_when_plugged_unplugged" android:defaultValue="true" /> + + <com.aokp.romcontrol.settings.CheckboxSetting + android:layout_width="match_parent" + android:layout_height="wrap_content" + + android:id="@+id/setting_force_highend_gfx" + android:title="@string/force_highend_gfx_title" + android:summary="@string/force_highend_gfx_summary" + /> </LinearLayout> diff --git a/res/values/strings.xml b/res/values/strings.xml index 0144de3..71ab8b4 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <!-- /** - * Copyright (c) 2013, The Android Open Kang Project + * Copyright (c) 2013-2014, The Android Open Kang Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -151,6 +151,8 @@ <string name="wakeup_when_plugged_unplugged_summary">Wake up device if a charger is plugged in or unplugged</string> <string name="ram_bar_title">Recents RAM bar</string> <string name="ram_bar_summary">Shows RAM usage in the recent apps window</string> + <string name="force_highend_gfx_title">Force high-end graphics</string> + <string name="force_highend_gfx_summary">Enables high-end visual effects such as transparent status/navigation bar (requires reboot)</string> <!-- Hardware keys --> <string name="title_hardware_keys_home_long_press">Home - long press</string> diff --git a/src/com/aokp/romcontrol/fragments/GeneralSettingsFragment.java b/src/com/aokp/romcontrol/fragments/GeneralSettingsFragment.java index 6b04548..d77cbfc 100644 --- a/src/com/aokp/romcontrol/fragments/GeneralSettingsFragment.java +++ b/src/com/aokp/romcontrol/fragments/GeneralSettingsFragment.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 The Android Open Kang Project + * Copyright (C) 2013-2014 The Android Open Kang Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,15 +16,23 @@ package com.aokp.romcontrol.fragments; +import android.app.ActivityManager; import android.app.Fragment; import android.os.Bundle; +import android.os.SystemProperties; import android.view.LayoutInflater; import android.view.View; +import android.view.View.OnClickListener; import android.view.ViewGroup; import com.aokp.romcontrol.R; +import com.aokp.romcontrol.settings.CheckboxSetting; public class GeneralSettingsFragment extends Fragment { + private static final String FORCE_HIGHEND_GFX_PERSIST_PROP = "persist.sys.force_highendgfx"; + + CheckboxSetting mForceHighEndGfx; + public GeneralSettingsFragment() { } @@ -33,6 +41,21 @@ public class GeneralSettingsFragment extends Fragment { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_general_settings, container, false); + mForceHighEndGfx = (CheckboxSetting) v.findViewById(R.id.setting_force_highend_gfx); + if (ActivityManager.isLowRamDeviceStatic()) { + String forceHighendGfx = SystemProperties.get(FORCE_HIGHEND_GFX_PERSIST_PROP, "false"); + mForceHighEndGfx.setChecked("true".equals(forceHighendGfx)); + mForceHighEndGfx.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + SystemProperties.set(FORCE_HIGHEND_GFX_PERSIST_PROP, + mForceHighEndGfx.isChecked() ? "true" : "false"); + } + }); + } else { + mForceHighEndGfx.setVisibility(View.GONE); + } + return v; } } |
