[Android Themes] Adi Aisiteru Reborn:
HOW TO ADD SCREENSHOT TOGGLE TO NOTIFICATION PANEL

AOSP / CM / MTK JB 4.2 ++

Hi guys :):victory::laugh::silly:

This mod is actually already in most of Open Source Rom Quicksettings Tiles view, but I change the code little bit to put the toggle on notification panel

Credit & thanks ;

- Carbon Rom, AOKP, cRdroid AOSP , CyanogenMod, BeanStalk

- [Unofficial Community] Galaxy Wonder CyanogenMod Indonesia

Feature :

- On click will take screenshot anywhere

- On long click will delay screenshot in 5 seconds

REQUIREMENT:

- BRAIN

- Patient

- experience

- Know how to decompile/recompiling Apk file

- Know how to decompile/recompiling jar Apk file

- notepad++

- Tool for decompiling, : apkmanager/apktool/Virtous/apkmultitools/ or else

STEP - 1

- Decompile your SystemUI.apk

- Download attached SCREENSHOT-SystemUI.zip exstract it and merge it to your decompiled SystemUI.apk

- SystemUI.apk/res/layout/status_bar_expanded_header.xml

add the red code

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/header" android:background="@drawable/notification_header_bg" android:layout_width="fill_parent" android:layout_height="@dimen/notification_panel_header_height" android:baselineAligned="false"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui">
<RelativeLayout android:enabled="false" android:id="@id/datetime" android:background="@drawable/ic_notify_button_bg" android:paddingLeft="8.0dip" android:paddingRight="8.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent">
<com.android.systemui.statusbar.policy.Clock android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Clock" android:id="@id/clock" android:clickable="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="8.0dip" android:singleLine="true" android:layout_centerVertical="true" />
<com.android.systemui.statusbar.policy.DateView android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Date" android:id="@id/date" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/clock" android:layout_centerVertical="true" />
</RelativeLayout>
[COLOR="Red"]<ImageButton android:id="@id/asteroid_screenshot_button" android:background="@drawable/asteroid_screenshot_button_bg" android:paddingTop="3.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_asteroid_screenshot" android:layout_toRightOf="@id/date" android:paddingStart="7.0dip" />[/COLOR]
<Space android:layout_width="0.0dip" android:layout_height="0.0dip" android:layout_weight="1.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" />
<ImageView android:id="@id/clear_all_button" android:layout_width="50.0dip" android:layout_height="50.0dip" android:src="@drawable/ic_notify_clear" android:scaleType="center" android:contentDescription="@string/accessibility_clear_all" />
<FrameLayout android:id="@id/settings_button_holder" android:layout_width="50.0dip" android:layout_height="50.0dip" android:layout_marginLeft="12.0dip">
<ImageView android:id="@id/settings_button" android:layout_width="50.0dip" android:layout_height="50.0dip" android:src="@drawable/ic_notify_settings" android:scaleType="center" android:contentDescription="@string/accessibility_desc_quick_settings" />
<ImageView android:id="@id/notification_button" android:visibility="gone" android:layout_width="50.0dip" android:layout_height="50.0dip" android:src="@drawable/ic_notifications" android:scaleType="center" android:contentDescription="@string/accessibility_notifications_button" />
</FrameLayout>
</LinearLayout>

- SystemUI.apk/res/values/strings.xml

add the red line to end of it before </resources>

<string name="status_bar_help_title">Notifications appear here</string>
<string name="status_bar_help_text">"Access them anytime by swiping down.
Swipe down again for system controls."</string>
[COLOR="Red"]<string name="permdesc_screenshot">Capture screenshot</string>
<string name="permlab_screenshot">Allows the app to cature a screenshot. This is protected by SystemUI.</string>
<string name="screenshot_toast">Screenshot in %1$d seconds</string>[/COLOR]
</resources>

- SystemUI.apk/res/values/ids.xml

add the red line to end of it before </resources>

<item type="id" name="notification_inspect_item">false</item>
<item type="id" name="recent_remove_item">false</item>
<item type="id" name="recent_inspect_item">false</item>
[COLOR="Red"]<item type="id" name="asteroid_screenshot_button">false</item>[/COLOR]
</resources>

- Recompile your SystemUI.apk

STEP - 2

- Decompile the newly Recompiled APK again

Next go to

res/values/public.xml

open it with Notepad++

leave it, but keep it open

- smali/com/android/systemui/statusbar/phone/PhoneStatusBar.smali

add the red lines :

.field mAnimY:F

.field mAnimating:Z

.field mAnimatingReveal:Z

[COLOR="Red"].field mAsteroidScreenshotButton:Landroid/widget/ImageButton;[/COLOR]

.field mBatteryController:Lcom/android/systemui/statusbar/policy/BatteryController;

.field mBluetoothController:Lcom/android/systemui/statusbar/policy/BluetoothController;

.field mFlipSettingsViewAnim:Landroid/animation/Animator;

.field mFocusChangeListener:Landroid/view/View$OnFocusChangeListener;

.field private final mGestureRec:Lcom/android/systemui/statusbar/GestureRecorder;

[COLOR="Red"].field public mHandler:Landroid/os/Handler;[/COLOR]

.field private mHasDockBattery:Z

.field mHasFlipSettings:Z

.field mQS:Lcom/android/systemui/statusbar/phone/QuickSettingsController;

.field mQueueLock:Ljava/lang/Object;

.field private final mRecentsClickListener:Landroid/view/View$OnClickListener;

.field private mRecreating:Z

[COLOR="Red"].field private mRunnable:Ljava/lang/Runnable;[/COLOR]

.field private mScreenWidth:F

.field mScrollView:Landroid/widget/ScrollView;

.field mScrollViewAnim:Landroid/animation/Animator;

- NEXT, Search this method

.method public constructor <init>()V

and add the red code

iput v2, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mDisabled:I

iput v2, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mSystemUiVisibility:I

[COLOR="Red"]new-instance v0, Landroid/os/Handler;

invoke-direct {v0}, Landroid/os/Handler;-><init>()V

iput-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mHandler:Landroid/os/Handler;[/COLOR]

new-instance v0, Landroid/util/DisplayMetrics;

invoke-direct {v0}, Landroid/util/DisplayMetrics;-><init>()V

iput-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mDisplayMetrics:Landroid/util/DisplayMetrics;

iput-object v3, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mGestureRec:Lcom/android/systemui/statusbar/GestureRecorder;

iput v2, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mNavigationIconHints:I

- NEXT, still in the same method,

add the red code above return-void

new-instance v0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$32;

invoke-direct {v0, p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$32;-><init>(Lcom/android/systemui/statusbar/phone/PhoneStatusBar;)V

iput-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mStartTracing:Ljava/lang/Runnable;

new-instance v0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$33;

invoke-direct {v0, p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$33;-><init>(Lcom/android/systemui/statusbar/phone/PhoneStatusBar;)V

iput-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mStopTracing:Ljava/lang/Runnable;

[COLOR="Red"]new-instance v0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$AsteroidSrcreenshot5;

invoke-direct {v0, p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$AsteroidSrcreenshot5;-><init>(Lcom/android/systemui/statusbar/phone/PhoneStatusBar;)V

iput-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mRunnable:Ljava/lang/Runnable;[/COLOR]

[COLOR="Blue"]return-void[/COLOR]
.end method

.method static synthetic access$000(Lcom/android/systemui/statusbar/phone/PhoneStatusBar;I)V
.locals 0
.parameter "x0"
.parameter "x1"

.prologue
.line 116
invoke-direct {p0, p1}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->adjustBrightness(I)V

return-void
.end method

- NEXT, add new access

return-void
.end method

[COLOR="Red"].method static synthetic access$130000000(Lcom/android/systemui/statusbar/phone/PhoneStatusBar;)Ljava/lang/Runnable;
.locals 1
.parameter "x0"

.prologue
.line 34
iget-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mRunnable:Ljava/lang/Runnable;

return-object v0
.end method[/COLOR]

.method static synthetic access$000(Lcom/android/systemui/statusbar/phone/PhoneStatusBar;I)V

NEXT

iget-object v1, v0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mLightsOnAnimation:Landroid/animation/Animator;

goto :goto_0
.end method

[COLOR="Red"].method private setupAsteroidScreenshotButton()V
.locals 3

.prologue
iget-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mStatusBarWindow:Lcom/android/systemui/statusbar/phone/StatusBarWindowView;

const v1, [COLOR="Blue"]0x7f0900e5[/COLOR]

invoke-virtual {v0, v1}, Lcom/android/systemui/statusbar/phone/StatusBarWindowView;->findViewById(I)Landroid/view/View;

move-result-object v0

check-cast v0, Landroid/widget/ImageButton;

iput-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mAsteroidScreenshotButton:Landroid/widget/ImageButton;

iget-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mAsteroidScreenshotButton:Landroid/widget/ImageButton;

new-instance v1, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$AsteroidSrcreenshot3;

invoke-direct {v1, p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$AsteroidSrcreenshot3;-><init>(Lcom/android/systemui/statusbar/phone/PhoneStatusBar;)V

invoke-virtual {v0, v1}, Landroid/widget/ImageButton;->setOnClickListener(Landroid/view/View$OnClickListener;)V

iget-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mAsteroidScreenshotButton:Landroid/widget/ImageButton;

new-instance v1, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$AsteroidSrcreenshot4;

invoke-direct {v1, p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$AsteroidSrcreenshot4;-><init>(Lcom/android/systemui/statusbar/phone/PhoneStatusBar;)V

invoke-virtual {v0, v1}, Landroid/widget/ImageButton;->setOnLongClickListener(Landroid/view/View$OnLongClickListener;)V

return-void
.end method[/COLOR]

.method private updateShowSearchHoldoff()V
.locals 2

.prologue
.line 1133
iget-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mContext:Landroid/content/Context;

invoke-virtual {v0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

move-result-object v0

const v1, 0x7f0d0001

invoke-virtual {v0, v1}, Landroid/content/res/Resources;->getInteger(I)I

move-result v0

iput v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mShowSearchHoldoff:I

.line 1135
return-void
.end method

NEXT, find this method

.method protected makeStatusBarView()Lcom/android/systemui/statusbar/phone/PhoneStatusBarView;

and add the red code

const-string v1, "android.intent.action.SCREEN_ON"

invoke-virtual {v0, v1}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V

.line 775
iget-object v1, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mBroadcastReceiver:Landroid/content/BroadcastReceiver;

invoke-virtual {v4, v1, v0}, Landroid/content/Context;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;

.line 778
invoke-direct {p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->resetUserSetupObserver()V

[COLOR="Red"] invoke-direct {p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->setupAsteroidScreenshotButton()V[/COLOR]

.line 780
iget-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mPowerWidget:Lcom/android/systemui/statusbar/powerwidget/PowerWidget;

invoke-virtual {v0}, Lcom/android/systemui/statusbar/powerwidget/PowerWidget;->setupWidget()V

.line 781
iget-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mPowerWidget:Lcom/android/systemui/statusbar/powerwidget/PowerWidget;

invoke-virtual {v0}, Lcom/android/systemui/statusbar/powerwidget/PowerWidget;->updateVisibility()V

.method public static viewInfo(Landroid/view/View;)Ljava/lang/String;
.locals 2
.parameter

OR MEDIATEK DEVICES

const-string v1, "android.intent.action.ACTION_BOOT_IPO"

invoke-virtual {v12, v1}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V

.line 768
const-string v1, "android.provider.Telephony.SPN_STRINGS_UPDATED"

invoke-virtual {v12, v1}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V

.line 769
move-object/from16 v0, p0

iget-object v1, v0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mBroadcastReceiver:Landroid/content/BroadcastReceiver;

invoke-virtual {v11, v1, v12}, Landroid/content/Context;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;

.line 772
invoke-direct/range {p0 .. p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->resetUserSetupObserver()V

[COLOR="Red"]invoke-direct/range {p0 .. p0}, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->setupAsteroidScreenshotButton()V[/COLOR]

.line 774
new-instance v20, Landroid/content/IntentFilter;

invoke-direct/range {v20 .. v20}, Landroid/content/IntentFilter;-><init>()V

.line 775
.local v20, simInfoIntentFilter:Landroid/content/IntentFilter;
const-string v1, "android.intent.action.SIM_SETTING_INFO_CHANGED"

NEXT,

go to,.

- smali/com/android/systemui/statusbar/phone/PhoneStatusBar$AsteroidSrcreenshot4.smali

search for this

const v4, [COLOR="Blue"]0x7f0a00f8[/COLOR]

Change this 0x7f0a00f8, according to the value you got in your own public.xml

<public type="string" name="screenshot_toast" id="[COLOR="Blue"]0x7f??????[/COLOR]" />

- NEXT

- Disable signature check

here : http://xdaforums.com/showthread.php?t=1698352

or in here : http://xdaforums.com/showpost.php?p=47592101&postcount=3

- AndroidManifest.xml

Add The RED CODE , and

REMOVE the BLUE CODE

<uses-permission android:name="android.permission.READ_DREAM_STATE" />
<uses-permission android:name="android.permission.WRITE_DREAM_STATE" />
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
[COLOR="Red"]<protected-broadcast android:name="android.permission.SCREENSHOT" />
<protected-broadcast android:name="android.intent.action.SCREENSHOT" />
<permission android:label="@string/permlab_screenshot" android:name="android.permission.SCREENSHOT" android:protectionLevel="signatureOrSystem" android:description="@string/permdesc_screenshot" />[/COLOR]
<application android:label="@string/app_label" android:icon="@*android:drawable/platlogo" android:allowClearUserData="false" android:persistent="true" android:allowBackup="false" android:hardwareAccelerated="true">
<service android:name="SystemUIService" android:exported="true" />
[COLOR="Red"]<service android:name=".screenshot.TakeScreenshotService" android:permission="android.permission.SCREENSHOT" android:exported="false" android:process=":screenshot">
<intent-filter>
<android name="android.intent.action.SCREENSHOT" />
</intent-filter>
</service>[/COLOR]
[COLOR="Blue"]<service android:name=".screenshot.TakeScreenshotService" android:exported="false" android:process=":screenshot" />[/COLOR]
<service android:name=".LoadAverageService" android:exported="true" />
<service android:name=".ImageWallpaper" android:permission="android.permission.BIND_WALLPAPER" android:exported="true" />
<receiver android:name=".BootReceiver" androidprv:primaryUserOnly="true">

- RECOMPILE YOUR SYSTEMUI.APK and SIGN it

- I ussually use ApkMultitools to decompile/recompile/sign APK

so if you use ApkMultitools, you can use my signer keys

download attached file, exstract it and merge to your ApkMultitools / other / here