FORUMS
Remove All Ads from XDA

[GUIDE] How to port SONY Small Apps to Any Device Cm Based Roms

6,230 posts
Thanks Meter: 6,932
 
By sandy7, Inactive Recognized Developer on 10th April 2013, 12:26 PM
Post Reply Email Thread
27th July 2013, 03:45 PM |#151  
thirdzcee's Avatar
Senior Member
Flag Bacolod City
Thanks Meter: 612
 
More
Quote:
Originally Posted by nokiagye

The multitasking with shall apps work?

Sent from my Xperia Arc S using xda premium

how do we get that kind of recent apps??? i had to remap the camera button to open small apps in my phone so i could launch any small app i want but i lose my camera shortcut ...
27th July 2013, 04:35 PM |#152  
SpaceCaker's Avatar
Senior Member
Flag netherlands
Thanks Meter: 11,016
 
More
Quote:
Originally Posted by nokiagye

The multitasking with shall apps work?

Sent from my Xperia Arc S using xda premium

i think i might know how we can get this kind of view

by using On click methods in systemuiservice or recentsactivity service

on click we launch app (the small app)

might work..

Sent from my S500 using xda app-developers app
The Following 3 Users Say Thank You to SpaceCaker For This Useful Post: [ View ] Gift SpaceCaker Ad-Free
28th July 2013, 07:40 AM |#153  
thirdzcee's Avatar
Senior Member
Flag Bacolod City
Thanks Meter: 612
 
More
Quote:
Originally Posted by SpaceCaker

i think i might know how we can get this kind of view

by using On click methods in systemuiservice or recentsactivity service

on click we launch app (the small app)

might work..

Sent from my S500 using xda app-developers app

True, but if your in a fullscreen app theres no statusbar, i preferred remaping the camera button since it still launches even in full screen apps , but what i really wanted is to get the externaltaskswitcher to work, i did a little analysis of the smalis but the phone smali gave me a headache because theres so many lines with externaltaskswitcher from xperria systemui and lesser lines for recentapp list in my systemui so i totally didnt know which lines to grab

Sent from my H100 using xda app-developers app
yamin8000
12th August 2013, 10:08 PM |#154  
Guest
Thanks Meter: 0
 
More
Quote:
Originally Posted by thirdzcee

True, but if your in a fullscreen app theres no statusbar, i preferred remaping the camera button since it still launches even in full screen apps , but what i really wanted is to get the externaltaskswitcher to work, i did a little analysis of the smalis but the phone smali gave me a headache because theres so many lines with externaltaskswitcher from xperria systemui and lesser lines for recentapp list in my systemui so i totally didnt know which lines to grab

Sent from my H100 using xda app-developers app

how do you do that?
how can i remap camera button to start small apps launcher?
13th August 2013, 12:30 AM |#155  
SpaceCaker's Avatar
Senior Member
Flag netherlands
Thanks Meter: 11,016
 
More
Quote:
Originally Posted by thirdzcee

True, but if your in a fullscreen app theres no statusbar, i preferred remaping the camera button since it still launches even in full screen apps , but what i really wanted is to get the externaltaskswitcher to work, i did a little analysis of the smalis but the phone smali gave me a headache because theres so many lines with externaltaskswitcher from xperria systemui and lesser lines for recentapp list in my systemui so i totally didnt know which lines to grab

Sent from my H100 using xda app-developers app

what i thought was that the real xperia taskswitcher dont use the original smali but sideloads the smali from different app


and if w add custom onclickmethod in recents view with layout modification we can get it like very close

even in fullscreen apps u can launch recents menu



Sent from my S500 using xda app-developers app
13th August 2013, 08:36 AM |#156  
Droidlover123's Avatar
Senior Member
Thanks Meter: 392
 
More
AWESOME MOD !!!!!!!!!!!!!

and i got one problem :

though i ported it to mine device successfully by your method but i can not see any new small app(that i afterward installed from play store like videomall) that i install smallappmanager app...

so any suggestions or fixes?????
14th August 2013, 03:22 AM |#157  
Senior Member
Flag São Paulo - SP
Thanks Meter: 397
 
More
Quote:
Originally Posted by SpaceCaker

what i thought was that the real xperia taskswitcher dont use the original smali but sideloads the smali from different app


and if w add custom onclickmethod in recents view with layout modification we can get it like very close

even in fullscreen apps u can launch recents menu



Sent from my S500 using xda app-developers app


Reverse engineer SystemUI.apk code of RecentsActivity.java from Xperia Z 4.2.2

Code:
package com.android.systemui.recent;

import android.app.*;
import android.content.*;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Bundle;
import android.os.UserHandle;
import android.view.*;
import android.widget.FrameLayout;
import com.android.systemui.statusbar.tablet.StatusBarPanel;
import com.sony.smallapp.internal.util.WindowUtils;
import java.util.List;

// Referenced classes of package com.android.systemui.recent:
//            RemotePluginView, RecentsPanelView, RecentTasksLoader

public class RecentsActivity extends Activity
{
    public class TouchOutsideListener
        implements android.view.View.OnTouchListener
    {

        private StatusBarPanel mPanel;
        final RecentsActivity this$0;

        public boolean onTouch(View view, MotionEvent motionevent)
        {
            int i = motionevent.getAction();
            if (i != 4 && (i != 0 || mPanel.isInContentArea((int)motionevent.getX(), (int)motionevent.getY())))
            {
                return false;
            } else
            {
                dismissAndGoHome();
                return true;
            }
        }

        public TouchOutsideListener(StatusBarPanel statusbarpanel)
        {
            this$0 = RecentsActivity.this;
            super();
            mPanel = statusbarpanel;
        }
    }


    private static int sLastOrientation = -1;
    private static RemotePluginView sPluginView;
    private ViewGroup mContainer;
    private boolean mForeground;
    private final String mHideSmallAppCallerString = (new Object()).toString();
    private IntentFilter mIntentFilter;
    private BroadcastReceiver mIntentReceiver;
    private boolean mOrientationChanged;
    private RecentsPanelView mRecentsPanel;
    private boolean mShowing;

    public RecentsActivity()
    {
        mIntentReceiver = new BroadcastReceiver() {

            final RecentsActivity this$0;

            public void onReceive(Context context, Intent intent)
            {
                if ("com.android.systemui.recent.action.CLOSE".equals(intent.getAction()))
                {
                    if (mRecentsPanel != null && mRecentsPanel.isShowing())
                    {
                        if (mShowing && !mForeground && !mOrientationChanged)
                        {
                            mRecentsPanel.show(false);
                            WindowUtils.showSmallAppWindows(RecentsActivity.this, mHideSmallAppCallerString);
                        }
                        mOrientationChanged = false;
                    }
                } else
                if ("com.android.systemui.recent.action.WINDOW_ANIMATION_START".equals(intent.getAction()))
                {
                    if (mRecentsPanel != null)
                    {
                        mRecentsPanel.onWindowAnimationStart();
                        return;
                    }
                } else
                if ("com.android.systemui.recent.action.CLOSE_RECENTS_INTENT_FROM_SMALL_APP_LAUNCHER".equals(intent.getAction()) && mRecentsPanel != null && mRecentsPanel.isShowing())
                {
                    dismissAndGoBack();
                    return;
                }
            }

            
            {
                this$0 = RecentsActivity.this;
                super();
            }
        }
;
    }

    private void attachPluginView()
    {
        if (sPluginView != null)
        {
            detachPluginView();
            ((ViewGroup)findViewById(0x7f080091)).addView(sPluginView);
            int i = sPluginView.getInitialHeight();
            ((FrameLayout)findViewById(0x7f08008c)).setPadding(0, 0, 0, i);
        }
    }

    public static void createPluginView(Context context)
    {
        if (sPluginView != null)
        {
            detachPluginView();
            sPluginView = null;
        }
        sPluginView = (RemotePluginView)View.inflate(context, 0x7f04000c, null);
    }

    private static void detachPluginView()
    {
        if (sPluginView != null)
        {
            android.view.ViewParent viewparent = sPluginView.getParent();
            if (viewparent != null && (viewparent instanceof ViewGroup))
                ((ViewGroup)viewparent).removeView(sPluginView);
        }
    }

    public static boolean forceOpaqueBackground(Context context)
    {
        return WallpaperManager.getInstance(context).getWallpaperInfo() != null;
    }

    public static int getPluginViewInitialHeight()
    {
        RemotePluginView remotepluginview = sPluginView;
        int i = 0;
        if (remotepluginview != null)
            i = sPluginView.getInitialHeight();
        return i;
    }

    private void handleIntent(Intent intent, boolean flag)
    {
        super.onNewIntent(intent);
        if ("com.android.systemui.recent.action.TOGGLE_RECENTS".equals(intent.getAction()))
        {
            if (mRecentsPanel != null)
                if (mShowing && mRecentsPanel.isShowing())
                {
                    dismissAndGoBack();
                } else
                {
                    RecentTasksLoader recenttasksloader1 = RecentTasksLoader.getInstance(this);
                    boolean flag3 = false;
                    if (flag)
                    {
                        boolean flag4 = intent.getBooleanExtra("com.android.systemui.recent.WAITING_FOR_WINDOW_ANIMATION", false);
                        flag3 = false;
                        if (flag4)
                            flag3 = true;
                    }
                    mRecentsPanel.show(true, recenttasksloader1.getLoadedTasks(), recenttasksloader1.isFirstScreenful(), flag3);
                    return;
                }
        } else
        if ("com.android.systemui.recent.action.OPEN_RECENTS_INTENT_FROM_SMALL_APP_LAUNCHER".equals(intent.getAction()) && mRecentsPanel != null)
        {
            RecentTasksLoader recenttasksloader = RecentTasksLoader.getInstance(this);
            boolean flag1 = false;
            if (flag)
            {
                boolean flag2 = intent.getBooleanExtra("com.android.systemui.recent.WAITING_FOR_WINDOW_ANIMATION", false);
                flag1 = false;
                if (flag2)
                    flag1 = true;
            }
            mRecentsPanel.show(true, recenttasksloader.getLoadedTasks(), recenttasksloader.isFirstScreenful(), flag1);
            return;
        }
    }

    private void updateWallpaperVisibility(boolean flag)
    {
        int i;
        if (flag)
            i = 0x100000;
        else
            i = 0;
        if (i != (0x100000 & getWindow().getAttributes().flags))
            getWindow().setFlags(i, 0x100000);
    }

    public void dismissAndGoBack()
    {
        if (mRecentsPanel != null)
        {
            List list = ((ActivityManager)getSystemService("activity")).getRecentTasks(2, 3);
            if (list.size() > 1 && mRecentsPanel.simulateClick(((android.app.ActivityManager.RecentTaskInfo)list.get(1)).persistentId))
                return;
            mRecentsPanel.show(false);
        }
        finish();
    }

    public void dismissAndGoHome()
    {
        if (mRecentsPanel != null)
        {
            Intent intent = new Intent("android.intent.action.MAIN", null);
            intent.addCategory("android.intent.category.HOME");
            intent.addFlags(0x10200000);
            startActivityAsUser(intent, new UserHandle(-2));
            mRecentsPanel.show(false);
        }
    }

    public boolean dispatchKeyEvent(KeyEvent keyevent)
    {
        boolean flag;
label0:
        {
            flag = true;
            if (sPluginView != null)
            {
                if (keyevent.getKeyCode() == 4 && keyevent.getAction() == flag)
                {
                    if (sPluginView.dispatchKeyEvent(keyevent))
                        break label0;
                    dismissAndGoBack();
                }
            } else
            if (keyevent.getKeyCode() == 4 && keyevent.getAction() == flag)
                dismissAndGoBack();
            flag = super.dispatchKeyEvent(keyevent);
        }
        return flag;
    }

    boolean isActivityShowing()
    {
        return mShowing;
    }

    protected void onCreate(Bundle bundle)
    {
        boolean flag = true;
        setContentView(0x7f04002b);
        mRecentsPanel = (RecentsPanelView)findViewById(0x7f08008b);
        mRecentsPanel.setOnTouchListener(new TouchOutsideListener(mRecentsPanel));
        RecentTasksLoader.getInstance(this).setRecentsPanel(mRecentsPanel, mRecentsPanel);
        mRecentsPanel.setMinSwipeAlpha((float)getResources().getInteger(0x7f0c0008) / 100F);
        boolean flag1;
        if (sLastOrientation != -1 && sLastOrientation != getResources().getConfiguration().orientation)
            flag1 = flag;
        else
            flag1 = false;
        mOrientationChanged = flag1;
        if (bundle == null || bundle.getBoolean("was_showing"))
        {
            Intent intent = getIntent();
            if (bundle != null)
                flag = false;
            handleIntent(intent, flag);
        }
        mIntentFilter = new IntentFilter();
        mIntentFilter.addAction("com.android.systemui.recent.action.CLOSE");
        mIntentFilter.addAction("com.android.systemui.recent.action.WINDOW_ANIMATION_START");
        mIntentFilter.addAction("com.android.systemui.recent.action.CLOSE_RECENTS_INTENT_FROM_SMALL_APP_LAUNCHER");
        registerReceiver(mIntentReceiver, mIntentFilter);
        mContainer = (ViewGroup)findViewById(0x7f080091);
        if (sPluginView == null)
            createPluginView(this);
        attachPluginView();
        super.onCreate(bundle);
    }

    protected void onDestroy()
    {
        RecentTasksLoader.getInstance(this).setRecentsPanel(null, mRecentsPanel);
        unregisterReceiver(mIntentReceiver);
        mContainer.removeView(sPluginView);
        super.onDestroy();
    }

    protected void onNewIntent(Intent intent)
    {
        handleIntent(intent, true);
    }

    public void onPause()
    {
        overridePendingTransition(0x7f05000e, 0x7f05000f);
        mForeground = false;
        super.onPause();
    }

    public void onResume()
    {
        sLastOrientation = getResources().getConfiguration().orientation;
        mForeground = true;
        super.onResume();
    }

    protected void onSaveInstanceState(Bundle bundle)
    {
        bundle.putBoolean("was_showing", mRecentsPanel.isShowing());
    }

    public void onStart()
    {
        if (forceOpaqueBackground(this))
            updateWallpaperVisibility(false);
        else
            updateWallpaperVisibility(true);
        mShowing = true;
        if (mRecentsPanel != null)
        {
            if (!mRecentsPanel.isShowing())
                mRecentsPanel.show(true);
            mRecentsPanel.refreshViews();
        }
        WindowUtils.hideSmallAppWindows(this, mHideSmallAppCallerString);
        super.onStart();
    }

    public void onStop()
    {
        mShowing = false;
        if (mRecentsPanel != null)
            mRecentsPanel.onUiHidden();
        WindowUtils.showSmallAppWindows(this, mHideSmallAppCallerString);
        super.onStop();
    }







/*
    static boolean access$302(RecentsActivity recentsactivity, boolean flag)
    {
        recentsactivity.mOrientationChanged = flag;
        return flag;
    }

*/

}
16th August 2013, 10:31 PM |#158  
Senior Member
Flag São Paulo - SP
Thanks Meter: 397
 
More
Hell it's to much complex for me
17th August 2013, 09:27 AM |#159  
spiderio's Avatar
Senior Member
Flag Jakarta
Thanks Meter: 919
 
Donate to Me
More
Gonna try it soon on om Sensation
I hope I won't messed something up
19th August 2013, 08:51 PM |#160  
Senior Member
Thanks Meter: 32
 
More
Let me get this right.
This MOD works on non-Xperia devices running CM10.1?
20th August 2013, 03:27 AM |#161  
sandy7's Avatar
OP Inactive Recognized Developer
Flag bangalore
Thanks Meter: 6,932
 
Donate to Me
More
Quote:
Originally Posted by leris2

Let me get this right.
This MOD works on non-Xperia devices running CM10.1?

Yes it does work on any device running cm9 and above

Sent from my C5302 using XDA Premium HD app
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes