Replacing status bar - Android Q&A, Help & Troubleshooting

Hey,
I have Knox license which with it I have managed to get some system-only permissions. For instance:
"android.permission.STATUS_BAR_SERVICE"
According to the source code:
<!-- Allows an application to be the status bar. Currently used only by SystemUI.apk
@hide -->
<permission android:name="android.permission.STATUS_BAR_SERVICE"
android:label="@string/permlab_statusBarService"
android:description="@string/permdesc_statusBarService"
android: protectionLevel="signature" />
So technically, since Knox said it was able to give my app these permissions I can replace the system's status bar.
Question is, how do I go about doing that?
Thanks, sorry I posted it here, I have too low post count to post in developing sections

Related

[Q][DEV] Question about GingerBread code - Settings.apk

Hello everyone!
I recently started modfying Settings.apk to make it look like ICS following THIS GUIDE.
What I'm trying to do, though, is to add toggle buttons to the Wi-Fi and Bluetooth options, just like ICS.
This code:
Code:
<PreferenceScreen android:title="@string/settings_label" android:key="parent"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
<PreferenceCategory android:title="@string/settings_ics_radio" />
<CheckBoxPreference android:persistent="false" android:title="@string/wifi_quick_toggle_title" android:key="enable_wifi" android:summary="@string/wifi_quick_toggle_summary" />
Adds the button, but that said button does nothing.
What do I need to add in order to make it work?
Edit: I see from here that it might require smali editing, but I'm not too sure since that last guide was trying to add a toggle that didn't actually exist before, and I just want to add a button that already exists in another menu.
Thanks in advance.

[Q] Adding a Status Bar signal option to Settings.apk

I hope this is the correct forum
I am doing this to Cyanogenmod 11.
I want to add an option to Settings > Interface > Status Bar > Signal Status Style. I am so close to having it done, but there is one thing I am missing, and that is actually getting the radio button to switch the Icon to the correct .java. Here is what I have done so far:
Added to Setting/res/values/cm_strings.xml;
Code:
<string name="status_bar_signal_style_always">Always show type</string>
Added two lines to Settings/res/values/cm_arrays.xml;(marked with *'s)
Code:
<string-array name="entries_status_bar_signal" translatable="false">
<item>@string/status_bar_signal_style_icon</item>
<item>@string/status_bar_signal_style_text</item>
*<item>@string/status_bar_signal_style_always</item>
<item>@string/status_bar_style_hidden</item>
</string-array>
<string-array name="values_status_bar_signal" translatable="false">
<item>0</item>
<item>1</item>
<item>2</item>
*<item>3</item>
</string-array>
Created a new java file named SignalClusterAlwaysView.java in SystemUI/src/com/android/systemui/statusbar and signal_cluster_always_view.xml in SystemUI/res/layout, respectively;
Added to SystemUI/res/layout/status_bar.xml;
Code:
<include layout="@layout/signal_cluster_always_view"
android:id="@+id/signal_cluster_always"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
Added (changed STYLE_HIDDEN to 3) in SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java.
Code:
public static final int STYLE_ALWAYS = 2;
Really all I am trying to do is create a setting to show network type even while WiFi is connected. This is accomplished by simply clearing this line from SignalClusterView.java,
Code:
mMobileType.setVisibility(
!mWifiVisible ? View.VISIBLE : View.GONE);
and changing android:layout_marginEnd to 3dip in signal_cluster_view.xml.
I can't seem to figure out how the existing setting for a text only network icon sends that to SystemUI. I've explored StatusBar.java in the Settings.apk source, and I think the issue may be in this line,
Code:
int signalStyle = Settings.System.getInt(resolver, Settings.System.STATUS_BAR_SIGNAL_TEXT, 0);
where it is setting the value of the option selected to Settings.System.STATUS_BAR_SIGNAL_TEXT. I think it is properly setting the value to 2, like I want, but it still sees 2 as HIDDEN instead of ALWAYS; or that it does see I want ALWAYS, but doesn't know to refer to SignalClusterAlwaysView.java in SystemUI.
What am I missing? Is there an easier way to do this?
Sorry if this is in the wrong thread.
I just checked, and yes, the value of STATUS_BAR_SIGNAL is changing to my intended values. My one missing link is defining what those values do.
Where is the file that contains the value assignments? i.e. STATUS_BAR_SIGNAL = 1 starts StatusBarTextView.java in systemui, while 2 and 3 don't do anything. I don't care about 3, just need to make 2 start StatusBarAlwaysView.java (or that process, obviously it isn't .java once compiled).
I answered my own question here: http://stackoverflow.com/questions/21869758/adding-a-setting-option-in-android-settings-apk/21881423#21881423

Remove Whatsapp status feature in Rooted/Non-Rooted android

Remove Whatsapp status featureRemove Whatsapp status feature
Rooted :
To Remove Whatsapp status feature
0. Force Stop WhatsApp before proceeding.
1. a. For Root Explorers, open the file ‘/data/data/com.whatsapp/shared_prefs/com.whatsapp_preferences.xml‘
b. For SharedPreference Editors, select ‘WhatsApp’ and then select ‘com.whatsapp_preferences‘.
2. Find the key name: ‘status_mode‘ and edit its value from ‘1’ and make it as ‘0’.
From:
<int name="status_mode" value="1"/>
To:
<int name="status_mode" value="0"/>
3. Now, launch WhatsApp and see if there’s a difference
Note: This is currently working in version 2.17.81
Non- Rooted - Visit Source
source : http://developeit.net/remove-whatsapp-status-feature-in-rootednon-rooted-android/

How to disable components without root?

Is it possible to disable receivers without root?
pm disable? I'm not really familiar with it.
I don't really want to root and I've been trying to find out ways to disable receivers in apps.
StickyPuppyPerson said:
Is it possible to disable receivers without root?
pm disable? I'm not really familiar with it.
I don't really want to root and I've been trying to find out ways to disable receivers in apps.
Click to expand...
Click to collapse
It's possible, to disable an app go to settings-->apps and notifications-->All Apps and find the one you want to disable in the list. Click it and then click "disable".
The process may vary depending on the Android version, but I'm sure you can do it (this feature appeared but Android Ice Cream Sandwich).
P.s: You can't disable some apps because they are necessary to the system.
@StickyPuppyPerson
THREAD'S TITLE IS TOTALLY MISLEADING!
Anyway:
Apps can register receivers. These are specified in app's Manifest.xml file.
Example:
Code:
<receiver android:name=".MyBroadcastReceiver"
android:exported="true"
android:enabled="true" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<action android:name="android.intent.action.INPUT_METHOD_CHANGED" />
</intent-filter>
</receiver>
Hence to disable/remove a receiver you would either have to change content of app's Manifest.xml file manually or programmatically by means of Android's PacketManager ( Note: if it's NOT a system app you want to modify then to do NO root is required ).
jwoegerbauer said:
@StickyPuppyPerson
THREAD'S TITLE IS TOTALLY MISLEADING!
Anyway:
Apps can register receivers. These are specified in app's Manifest.xml file.
Example:
Code:
<receiver android:name=".MyBroadcastReceiver"
android:exported="true"
android:enabled="true" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<action android:name="android.intent.action.INPUT_METHOD_CHANGED" />
</intent-filter>
</receiver>
Hence to disable/remove a receiver you would either have to change content of app's Manifest.xml file manually or programmatically by means of Android's PacketManager ( Note: if it's NOT a system app you want to modify then to do NO root is required ).
Click to expand...
Click to collapse
How should I rename it?
Could you show me an example with adb?
Was wondering if there was an app for this that works with no root adb.
StickyPuppyPerson said:
How should I rename it?
Click to expand...
Click to collapse
Because there are four different types of app components:
Activities
Services
Broadcast receivers
Content providers
specify the component -> Replace "components" by "receivers"
Was wondering if there was an app for this that works with no root adb.
Click to expand...
Click to collapse
May be a so-called APK-Editor does the job: Don't know it.

Hide an APK without having access to the source code.

I had an APK that I installed on my phone that I did not want anybody seeing so I used the method in the following post: https://forum.xda-developers.com/t/how-to-make-an-apk-hidden-when-it-installs.1501053
Essentially what I did was I replaced :
Code:
<category android:name="android.intent.category.LAUNCHER"/>
by
Code:
<category android:name="android.intent.category.DEFAULT"/>
Now the app is hidden but I cannot open it even when going into the settings. I want to see if there is a way to keep the app hidden but be able to open it somehow. I saw this stack overflow post: https://stackoverflow.com/questions...-app-without-android-intent-category-launcher, but that assumes that I have access to the source code which I do not.
I appreciate any help possible, thank you.
Maybe something like Activity Launcher would help? IDK..

Categories

Resources