Can you show a code diff? 
Does ic_flash_on_black exist? I did not find it in the base/core/res/res so 
I guess you added it yourself...(did you make update-api to reflect it in 
current.txt & system-current.txt?)
I looked at the code and I would: 

Create a new class in GlobalActions: 

private final class MyPowerAction extends SinglePressAction implements 
LongPressAction {
        private MyPowerAction() {
            super(com.android.internal.R.drawable.ic_flash_on_black,
                R.string.global_action_mypower_off);
        }

        @Override
        public boolean onLongPress() {
            // Do your thing here....you could also extend 
WindowManagerFuncs to add your function and do it from there...
            return true;
        }

       @Override
        public boolean showDuringKeyguard() {
            return true;
        }

        @Override
        public boolean showBeforeProvisioning() {
            return true;
        }

       @Override
        public void onPress() {
        }
}

in GlobalActionsDialog createDialog() ..... add your new class : 

if (GLOBAL_ACTION_KEY_POWER.equals(actionKey)) {
                mItems.add(new PowerAction());
                mItems.add(new MyPowerAction());
} 

.....

I could be wrong....but I hope it helps....

Daniel. 


On Thursday, May 12, 2016 at 5:38:20 PM UTC+3, Vivekanand Elango wrote:
>
> Hi,
>
> I'm trying to modify AOSP for my firmware. I want to intercept PowerButton 
> long press to add another option in the dialog box.
>
> I tried adding another item to the " dialog box list " in GlobalActions.java, 
> but on building it I get "Cannot find symbol Error".
>
>
> <https://lh3.googleusercontent.com/-cQU_0S1JH0Q/VzM9xA3D8eI/AAAAAAAABUk/8DqYkC_2SXETgoReFomCRL6wRVbGH2M-ACLcB/s1600/Flashlighterror.png>
>
>
> Could somebody tell me what I'm doing wrong. All I want to do is add 
> <Action>another 
> item to the dialog list.
>

-- 
-- 
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: http://groups.google.com/group/android-porting

--- 
You received this message because you are subscribed to the Google Groups 
"android-porting" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-porting+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to