[Sony Cross-Device Development Themes and Apps] Ticklefish:
​

Would you like to start your camera app anytime you like? Just by pulling down your notification screen and pressing a button?

Yes?

Oh, good! Then read on and I'll show you how!

For this mod, you're going to need a decompiled SystemUI.apk. It can be odexed or deodexed, it really doesn't matter. If you don't have experience with decompiling and recompiling APK files, I suggest having a look at Tickle My Android (tinyurl.com/ticklemyandroid. It's made by a very good friend of mine and it's very useful for this sort of thing.

Once you've decompiled your APK, you'll need to edit "SystemUI.apk/res/layout/status_bar_expanded_header.xml". On stock 5.1.1. that looks like this:

<?xml version="1.0" encoding="utf-8"?>
<com.android.systemui.statusbar.phone.StatusBarHeaderView android:layout_gravity="@integer/notification_panel_layout_gravity" android:id="@id/header" android:background="@drawable/notification_header_bg" android:focusable="true" android:clickable="true" android:layout_width="@dimen/notification_panel_width" android:layout_height="@dimen/status_bar_header_height" android:baselineAligned="false" android:paddingStart="@dimen/notification_side_padding" android:paddingEnd="@dimen/notification_side_padding" android:elevation="4.0dip"
xmlns:android="[URL]http://schemas.android.com/apk/res/android[/URL]" xmlns:systemui="[URL]http://schemas.android.com/apk/res-auto[/URL]">
[COLOR=red] <com.android.systemui.statusbar.phone.MultiUserSwitch android:id="@id/multi_user_switch" android:background="@drawable/ripple_drawable" android:layout_width="@dimen/multi_user_switch_width_collapsed" android:layout_height="@dimen/status_bar_header_height" android:layout_alignParentEnd="true">[/COLOR]
[COLOR=red] <ImageView android:layout_gravity="center" android:id="@id/multi_user_avatar" android:layout_width="@dimen/multi_user_avatar_expanded_size" android:layout_height="@dimen/multi_user_avatar_expanded_size" android:scaleType="centerInside" />[/COLOR]
[COLOR=red] </com.android.systemui.statusbar.phone.MultiUserSwitch>[/COLOR]
<com.android.keyguard.AlphaOptimizedImageButton android:id="@id/settings_button" android:background="@drawable/ripple_drawable" android:layout_width="@dimen/multi_user_switch_width_collapsed" android:layout_height="@dimen/status_bar_header_height" android:src="@drawable/ic_settings" android:contentDescription="@string/accessibility_desc_settings" android:layout_toStartOf="@id/multi_user_switch" style="@android:style/Widget.Material.Button.Borderless" />
<ImageButton android:id="@id/task_manager_button" android:visibility="gone" android:layout_width="48.0dip" android:layout_height="@dimen/status_bar_header_height" android:src="@drawable/ic_tasklist_switch_normal" android:layout_marginStart="8.0dip" android:layout_toStartOf="@id/settings_button" style="@android:style/Widget.Material.Button.Borderless" />
<ImageButton android:id="@id/somc_qs_button" android:background="@drawable/ripple_drawable" android:layout_width="@dimen/multi_user_switch_width_collapsed" android:layout_height="@dimen/status_bar_header_height" android:src="@drawable/ic_edit_settings" android:contentDescription="@string/accessibility_desc_edit_quick_settings" android:layout_toStartOf="@id/settings_button" style="@android:style/Widget.Material.Button.Borderless" />
<LinearLayout android:id="@id/system_icons_super_container" android:background="@drawable/ripple_drawable" android:layout_width="wrap_content" android:layout_height="@dimen/status_bar_header_height" android:layout_alignWithParentIfMissing="true" android:paddingEnd="4.0dip" android:layout_marginStart="16.0dip" android:layout_toStartOf="@id/multi_user_switch">
<FrameLayout android:layout_gravity="center_vertical" android:id="@id/system_icons_container" android:layout_width="wrap_content" android:layout_height="@dimen/status_bar_height">
<include layout="@layout/system_icons" />
</FrameLayout>
<TextView android:textSize="@dimen/battery_level_text_size" android:textColor="#ffffffff" android:layout_gravity="center_vertical" android:id="@id/battery_level" android:layout_width="wrap_content" android:layout_height="wrap_content" android:importantForAccessibility="noHideDescendants" android:paddingEnd="@dimen/battery_level_padding_end" android:layout_marginStart="@dimen/header_battery_margin_expanded" />
</LinearLayout>
<com.android.keyguard.CarrierText android:gravity="center_vertical" android:orientation="vertical" android:id="@id/expanded_carrier_text" android:paddingTop="13.0dip" android:paddingBottom="13.0dip" android:layout_width="wrap_content" android:layout_height="@dimen/status_bar_header_height" android:paddingStart="16.0dip" android:layout_toStartOf="@id/system_icons_super_container" android:layout_alignParentStart="true" />
<TextView android:textAppearance="@style/TextAppearance.StatusBar.Expanded.EmergencyCallsOnly" android:gravity="center_vertical" android:id="@id/header_emergency_calls_only" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="@dimen/status_bar_header_height" android:text="@android:string/emergency_calls_only" android:singleLine="true" android:paddingStart="16.0dip" android:paddingEnd="16.0dip" android:layout_toStartOf="@id/system_icons_super_container" android:layout_alignParentStart="true" />
<FrameLayout android:id="@id/date_group" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="@dimen/clock_collapsed_bottom_margin" android:layout_alignParentBottom="true">
<com.android.systemui.statusbar.policy.DateView android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Date" android:id="@id/date_collapsed" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" android:layout_below="@id/clock" android:layout_marginStart="16.0dip" systemui:datePattern="@string/abbrev_wday_month_day_no_year_alarm" />
<com.android.systemui.statusbar.policy.DateView android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Date" android:id="@id/date_expanded" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" android:layout_below="@id/clock" android:layout_marginStart="16.0dip" systemui:datePattern="eeeeMMMMd" />
</FrameLayout>
<include android:id="@id/clock" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@id/date_group" android:layout_marginStart="16.0dip" layout="@layout/split_clock_view" />
<Button android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Date" android:textColor="#64ffffff" android:id="@id/alarm_status" android:background="?android:selectableItemBackground" android:paddingTop="16.0dip" android:paddingBottom="16.0dip" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="4.0dip" android:drawablePadding="6.0dip" android:layout_alignParentBottom="true" android:drawableStart="@drawable/ic_access_alarms_small" android:paddingStart="6.0dip" android:paddingEnd="6.0dip" android:layout_toEndOf="@id/date_group" />
<include android:id="@id/qs_detail_header" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" layout="@layout/qs_detail_header" />
<com.android.systemui.statusbar.AlphaOptimizedImageView android:id="@id/qs_detail_header_progress" android:background="@color/qs_detail_progress_track" android:layout_width="fill_parent" android:layout_height="wrap_content" android:src="@drawable/indeterminate_anim" android:layout_alignParentBottom="true" android:alpha="0.0" />
<TextView android:textSize="11.0dip" android:textStyle="bold" android:textColor="#ff00a040" android:layout_gravity="center_vertical" android:id="@id/header_debug_info" android:padding="2.0dip" android:visibility="invisible" android:layout_width="wrap_content" android:layout_height="wrap_content" android:fontFamily="sans-serif-condensed" />
</com.android.systemui.statusbar.phone.StatusBarHeaderView>

I'm the only one who uses my phone so I don't need that MultiUserSwitch. I'll put my camera button there instead. If you delete that section of code, your APK will FC. So let's hide it.

<com.android.systemui.statusbar.phone.MultiUserSwitch android:id="@id/multi_user_switch" android:background="@drawable/ripple_drawable" [COLOR=red]android:layout_width="0.0dip" android:layout_height="0.0dip" [/COLOR]android:layout_alignParentEnd="true">
<ImageView android:layout_gravity="center" android:id="@id/multi_user_avatar" android:layout_width="@dimen/multi_user_avatar_expanded_size" android:layout_height="@dimen/multi_user_avatar_expanded_size" android:scaleType="centerInside" />
</com.android.systemui.statusbar.phone.MultiUserSwitch>

Now we need to add our camera button line.

<com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/ModCamera" android:layout_width="@dimen/multi_user_switch_width_collapsed" android:layout_height="@dimen/status_bar_header_height" android:src="@drawable/camerawhite" android:scaleType="center"[COLOR=black] systemui:keyCode="27"[/COLOR] android:layout_alignParentEnd="true" android:paddingEnd="4.0dip" />

This line needs to be added just above our MultiUserSwitch code:

<com.android.systemui.statusbar.policy.KeyButtonView [COLOR=red]android:id="@+id/ModCamera"[/COLOR] android:layout_width="@dimen/multi_user_switch_width_collapsed" android:layout_height="@dimen/status_bar_header_height" android:src="@drawable/camerawhite" android:scaleType="center" systemui:keyCode="27" android:layout_alignParentEnd="true" android:paddingEnd="4.0dip" />
<com.android.systemui.statusbar.phone.MultiUserSwitch android:id="@id/multi_user_switch" android:background="@drawable/ripple_drawable" android:layout_width="0.0dip" android:layout_height="0.0dip" android:layout_alignParentEnd="true">
<ImageView android:layout_gravity="center" android:id="@id/multi_user_avatar" android:layout_width="@dimen/multi_user_avatar_expanded_size" android:layout_height="@dimen/multi_user_avatar_expanded_size" android:scaleType="centerInside" />
</com.android.systemui.statusbar.phone.MultiUserSwitch>

Because we've removed the MultiUserSwitch, we need to make sure that the other elements of this screen line up correctly. To do that, you need to use the id that we gave to our camera button - "android:id="@+id/ModCamera"".

So change this line:

<com.android.keyguard.AlphaOptimizedImageButton android:id="@id/settings_button" android:background="@drawable/ripple_drawable" android:layout_width="@dimen/multi_user_switch_width_collapsed" android:layout_height="@dimen/status_bar_header_height" android:src="@drawable/ic_settings" android:contentDescription="@string/accessibility_desc_settings" [COLOR=red]android:layout_toStartOf="@id/ModCamera"[/COLOR] style="@android:style/Widget.Material.Button.Borderless" />

And this line:

<LinearLayout android:id="@id/system_icons_super_container" android:background="@drawable/ripple_drawable" android:layout_width="wrap_content" android:layout_height="@dimen/status_bar_header_height" android:layout_alignWithParentIfMissing="true" android:paddingEnd="4.0dip" android:layout_marginStart="16.0dip" [COLOR=red]android:layout_toStartOf="@id/ModCamera"[/COLOR]>

Here's the final code:

<?xml version="1.0" encoding="utf-8"?>
<com.android.systemui.statusbar.phone.StatusBarHeaderView android:layout_gravity="@integer/notification_panel_layout_gravity" android:id="@id/header" android:background="@drawable/notification_header_bg" android:focusable="true" android:clickable="true" android:layout_width="@dimen/notification_panel_width" android:layout_height="@dimen/status_bar_header_height" android:baselineAligned="false" android:paddingStart="@dimen/notification_side_padding" android:paddingEnd="@dimen/notification_side_padding" android:elevation="4.0dip"
xmlns:android="[URL]http://schemas.android.com/apk/res/android[/URL]" xmlns:systemui="[URL]http://schemas.android.com/apk/res-auto[/URL]">
<com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/ModCamera" android:layout_width="@dimen/multi_user_switch_width_collapsed" android:layout_height="@dimen/status_bar_header_height" android:src="@drawable/camerawhite" android:scaleType="center" systemui:keyCode="27" android:layout_alignParentEnd="true" android:paddingEnd="4.0dip" />
<com.android.systemui.statusbar.phone.MultiUserSwitch android:id="@id/multi_user_switch" android:background="@drawable/ripple_drawable" android:layout_width="0.0dip" android:layout_height="0.0dip" android:layout_alignParentEnd="true">
<ImageView android:layout_gravity="center" android:id="@id/multi_user_avatar" android:layout_width="@dimen/multi_user_avatar_expanded_size" android:layout_height="@dimen/multi_user_avatar_expanded_size" android:scaleType="centerInside" />
</com.android.systemui.statusbar.phone.MultiUserSwitch>
<com.android.keyguard.AlphaOptimizedImageButton android:id="@id/settings_button" android:background="@drawable/ripple_drawable" android:layout_width="@dimen/multi_user_switch_width_collapsed" android:layout_height="@dimen/status_bar_header_height" android:src="@drawable/ic_settings" android:contentDescription="@string/accessibility_desc_settings" android:layout_toStartOf="@id/ModCamera" style="@android:style/Widget.Material.Button.Borderless" />
<ImageButton android:id="@id/task_manager_button" android:visibility="gone" android:layout_width="48.0dip" android:layout_height="@dimen/status_bar_header_height" android:src="@drawable/ic_tasklist_switch_normal" android:layout_marginStart="8.0dip" android:layout_toStartOf="@id/settings_button" style="@android:style/Widget.Material.Button.Borderless" />
<ImageButton android:id="@id/somc_qs_button" android:background="@drawable/ripple_drawable" android:layout_width="@dimen/multi_user_switch_width_collapsed" android:layout_height="@dimen/status_bar_header_height" android:src="@drawable/ic_edit_settings" android:contentDescription="@string/accessibility_desc_edit_quick_settings" android:layout_toStartOf="@id/settings_button" style="@android:style/Widget.Material.Button.Borderless" />
<LinearLayout android:id="@id/system_icons_super_container" android:background="@drawable/ripple_drawable" android:layout_width="wrap_content" android:layout_height="@dimen/status_bar_header_height" android:layout_alignWithParentIfMissing="true" android:paddingEnd="4.0dip" android:layout_marginStart="16.0dip" android:layout_toStartOf="@id/ModCamera">
<FrameLayout android:layout_gravity="center_vertical" android:id="@id/system_icons_container" android:layout_width="wrap_content" android:layout_height="@dimen/status_bar_height">
<include layout="@layout/system_icons" />
</FrameLayout>
<TextView android:textSize="@dimen/battery_level_text_size" android:textColor="#ffffffff" android:layout_gravity="center_vertical" android:id="@id/battery_level" android:layout_width="wrap_content" android:layout_height="wrap_content" android:importantForAccessibility="noHideDescendants" android:paddingEnd="@dimen/battery_level_padding_end" android:layout_marginStart="@dimen/header_battery_margin_expanded" />
</LinearLayout>
<com.android.keyguard.CarrierText android:gravity="center_vertical" android:orientation="vertical" android:id="@id/expanded_carrier_text" android:paddingTop="13.0dip" android:paddingBottom="13.0dip" android:layout_width="wrap_content" android:layout_height="@dimen/status_bar_header_height" android:paddingStart="16.0dip" android:layout_toStartOf="@id/system_icons_super_container" android:layout_alignParentStart="true" />
<TextView android:textAppearance="@style/TextAppearance.StatusBar.Expanded.EmergencyCallsOnly" android:gravity="center_vertical" android:id="@id/header_emergency_calls_only" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="@dimen/status_bar_header_height" android:text="@android:string/emergency_calls_only" android:singleLine="true" android:paddingStart="16.0dip" android:paddingEnd="16.0dip" android:layout_toStartOf="@id/system_icons_super_container" android:layout_alignParentStart="true" />
<FrameLayout android:id="@id/date_group" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="@dimen/clock_collapsed_bottom_margin" android:layout_alignParentBottom="true">
<com.android.systemui.statusbar.policy.DateView android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Date" android:id="@id/date_collapsed" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" android:layout_below="@id/clock" android:layout_marginStart="16.0dip" systemui:datePattern="@string/abbrev_wday_month_day_no_year_alarm" />
<com.android.systemui.statusbar.policy.DateView android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Date" android:id="@id/date_expanded" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" android:layout_below="@id/clock" android:layout_marginStart="16.0dip" systemui:datePattern="eeeeMMMMd" />
</FrameLayout>
<include android:id="@id/clock" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@id/date_group" android:layout_marginStart="16.0dip" layout="@layout/split_clock_view" />
<Button android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Date" android:textColor="#64ffffff" android:id="@id/alarm_status" android:background="?android:selectableItemBackground" android:paddingTop="16.0dip" android:paddingBottom="16.0dip" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="4.0dip" android:drawablePadding="6.0dip" android:layout_alignParentBottom="true" android:drawableStart="@drawable/ic_access_alarms_small" android:paddingStart="6.0dip" android:paddingEnd="6.0dip" android:layout_toEndOf="@id/date_group" />
<include android:id="@id/qs_detail_header" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" layout="@layout/qs_detail_header" />
<com.android.systemui.statusbar.AlphaOptimizedImageView android:id="@id/qs_detail_header_progress" android:background="@color/qs_detail_progress_track" android:layout_width="fill_parent" android:layout_height="wrap_content" android:src="@drawable/indeterminate_anim" android:layout_alignParentBottom="true" android:alpha="0.0" />
<TextView android:textSize="11.0dip" android:textStyle="bold" android:textColor="#ff00a040" android:layout_gravity="center_vertical" android:id="@id/header_debug_info" android:padding="2.0dip" android:visibility="invisible" android:layout_width="wrap_content" android:layout_height="wrap_content" android:fontFamily="sans-serif-condensed" />
</com.android.systemui.statusbar.phone.StatusBarHeaderView>

Next, download the camera image from the attachment and put that into the appropriate "drawable-?dpi" folder.

And that's it. Recompile, put back on your phone and, once the phone's finished rebooting, you're good to go. Pull down your notification screen, long-press on the camera icon and your camera app starts!

(Why long-press? That's just the way that button works. Don't worry, you get used to it.)

Enjoy!