Devs - how would I change 1 .java file in your builds? - Touch CDMA General

I want to make some changes to
frameworks/policies/base/phone/com/android/internal/policy/impl/PhoneWindowManager.java
(I want to change the function of a long key press)
Is there a way I can make my changes and add them to an existing system.img? Or do I need to make my own system image from scratch?
Either way, is there a guide for how you are building yours?

Here's what I want to change if anyone is able to help:
I really want to add the recent apps key back...replacing the power off menu with recent apps. My new key layout has no HOME key.
I modified the code, but have no idea how to build it. Can anyone help me out?
Below is the output from "repo diff". This should launch the recent apps box instead of global actions.
Code:
project frameworks/policies/base/
diff --git a/phone/com/android/internal/policy/impl/PhoneWindowManager.java b/phone/com/android/internal/policy/impl/PhoneWindowManager.java
index 21c3267..ffcad94 100644
--- a/phone/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/phone/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -369,10 +369,14 @@ public class PhoneWindowManager implements WindowManagerPolicy {
Runnable mEndCallLongPress = new Runnable() {
public void run() {
+ // performHapticFeedbackLw(null, HapticFeedbackConstants.LONG_PRESS, false);
+ // sendCloseSystemWindows(SYSTEM_DIALOG_REASON_GLOBAL_ACTIONS);
+ // showGlobalActionsDialog();
+ mHomePressed = false;
performHapticFeedbackLw(null, HapticFeedbackConstants.LONG_PRESS, false);
- sendCloseSystemWindows(SYSTEM_DIALOG_REASON_GLOBAL_ACTIONS);
- showGlobalActionsDialog();
+ sendCloseSystemWindows(SYSTEM_DIALOG_REASON_RECENT_APPS);
+ showRecentAppsDialog();
}
};

pm me, I'll throw together something for you.

grantemsley said:
Here's what I want to change if anyone is able to help:
I really want to add the recent apps key back...replacing the power off menu with recent apps. My new key layout has no HOME key.
Click to expand...
Click to collapse
So we're loosing the power off menu? I thought that it wasnt all that good to soft reset and not let Android shut down properly. What about long-press power like it used to be mapped?

I PM'ed you mssmison.
I agree, loosing the power off button is not ideal. I've been trying to find a way to make a shortcut for it instead.
A better solution would be to have the recent apps menu come up on long press of the camera/back button (currently long press does nothing) or the call key (currently voice dial, I'd be ok giving that up).
However, I don't know how to change those particular keys.

grantemsley said:
I PM'ed you mssmison.
I agree, loosing the power off button is not ideal. I've been trying to find a way to make a shortcut for it instead.
A better solution would be to have the recent apps menu come up on long press of the camera/back button (currently long press does nothing) or the call key (currently voice dial, I'd be ok giving that up).
However, I don't know how to change those particular keys.
Click to expand...
Click to collapse
Yeah, long press cam makes sense..."go back to all previous apps" And double press cam for landscape. When you turn the phone that way your finger naturally hits it.

Related

A Call To Lock/Hardware Button Experts

Hello,
Im currently working on a custom control in managed code(vb.net) and have decided to implement it in a lock application as its initial demo. I have written code which catpures the base hardware keys available to windows mobile(1-6) this captures all of the hardware buttons on my wizard except for the Phone Buttons, Volume/Vibrate Button, and power button. im not particularly worried about trapping the power button because i like the tap to standby feature but im up the creek on the phone/volume buttons.
I found the hardware buttons 1-6 in the registry under (HKLM\Software\Microsoft\Shell\Keys) but i cant seem to find the other keys anywhere including where this person says they are
http://www.mobipocket.com/forum/viewtopic.php?p=2367&sid=c3b2c704a729c2d6e5a47d0ee38ecb54
basically from my understanding of what he's saying the keys for these options(at least the phone ones) should have been listed under "HKEY_CURRENT_USER\Software\Microsoft\Today\Keys\"
I had one key there 112 pointng to my calendar(so that i thought confirmed him) I added a key called 114 with a path to calendar as well. but the button still directs to phone/ so im not sure what's up.
Here's some logic from the hardware button capturing... Any insight into the location of these items would be greatly appreciated
Code:
Dim hk As HardwareKeys = HardwareKeys.ApplicationKey1
Dim i As Integer = 0
While i < 6
Try
Dim hwb As HardwareButton = New HardwareButton
hwb.AssociatedControl = Me
hwb.HardwareKey = hk + i
Catch ex As Exception
Me.Label1.Text &= ex.Message
End Try
i += 1
End While
Dim regkey As RegistryKey =
Registry.LocalMachine.OpenSubKey("Software\Microsoft\Shell\Keys", True)
Me.Label1.Text = regkey.SubKeyCount
For Each skey As String In regkey.GetSubKeyNames
Me.Label1.Text &= skey.ToString & ","
Next
regkey.Close()
Thanks in advance for any insight anyone can provide
DrewG
Well ive found some russian page talking about the
Dated Post on russian site with Broken English Translation said:
HKEY_LOCAL_MACHINE\Software\Microsoft\Shell\KeyMaps]
"195"= - =-hitting "record" on the three pozic. phone (one that najmeshy story)
"196"= hitting "power" and "house"
"197"= Opening screen
"198" = "red tube"
dword:00000000 - nothing
dword:00000001- mobile phone
dword:00000002 - quick menu
dword:00000003 - lock (for the press release #)
dword:00000004 - 00000004 fast-locking
Click to expand...
Click to collapse
Do you guys think this is a good start? At that location i have dword 197 val of 5. Im adding entries now for the othr buttons to see if i can catch
Here's What I have so far for Cingular 8125 HTC Wizard as the hardware buttons/software key maps which i get from a call onkeypress. I believe im going to have to go an unmanaged route for the phone buttons/Volume.
Code:
'not code just looks better this way
SoftKey Left = Key Code 112
SoftKey Right = Key Code 113
Email Button(top left corner) = Key Code 193 (Cf Hardware Button 1)
Web Button(top right corner) = Key Code 194 (Cf Hardware Button 2)
Camera Button(bottom right side) = Key Code 195 (Cf Hardware Button 3)
Voice Button(top right side) = Key Code 196(Cf Hardware Button 4)
Record(hold voice) = Key Code 197(not firing well) (Cf Hardware Button 5)
Comm Button = Key Code 198 (Cf Hardware Button 6)
All of those I can catch and react to but i cant seem to find any info for the phone and volume buttons/ Is there a specific api call I can make thats related to button press or catching? Possibly a way of forcing an association to an app only while its running?
Thanks in advance for any help. Ill post the full app here if i can get over this hump

[REQ]Remapping Camera shot key to volume button?

Hi there,
First of all I tried searching on google and also in this forum itself but I cant find anything related and so i decided to create a new thread on this.
If there anyway via tweaking the registry that i can make use of the volume key on the blackstone to take pictures instead of using the touchscreen? I believe this is possible
I find taking picture using a touchscreen is really difficult.
I read from http://wiki.xda-developers.com/index.php?pagename=HTC_Blackstone_Overview that this is possible by remapping the volume rocker.
Does any know how?
Will anyone be able to help?
I'm requesting this also. HTC should have made an option for us to choose for this from the beginning.
Request also here!
Sorry, I added this "remap volume rocker Solution" because I thought it was possible, but I actually didn't try it. So let's keep this thread to find a way to do it.
Remapping keys is through AE Button Plus or MobileMagic.
Right now we only have the choice of "touch" or "touch and hold" the virtual on-screen button to "auto-focus + shot".
We need to find out if there is any keyboard shortcut associated to that function.
I tried to use the "enter key" fonction remaped to Volume Up with AE Button Plus, but it didn't work.
Does the HTC Touch Pro have HTC's Camera application? maybe they know a keyboard shortcut? Let's ask.
I guess it will be possible.... just that we need the experts here to show us how to...
[APP] CameraButton
To solve this problem. I thought of a very simple solution:
Instead of us clicking the on-screen camera button, we need an application "CameraButton", which will click on the screen for us, then we just need to map a hardware button to that application.
Simple isn't it?
So here is the C# code for the CameraButton application:
Code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
namespace CameraButton
{
class Program
{
[System.Runtime.InteropServices.DllImport("coredll.DLL", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
public static extern IntPtr FindWindow(string lpClassName,string lpWindowName);
[System.Runtime.InteropServices.DllImport("coredll.DLL", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
static extern bool SetForegroundWindow(IntPtr hWnd);
[System.Runtime.InteropServices.DllImport("coredll.dll")]
static extern bool SetCursorPos(int X, int Y);
[System.Runtime.InteropServices.DllImport("coredll.dll")]
static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint dwData, int dwExtraInfo);
[Flags]
public enum MouseEventFlags
{
LEFTDOWN = 0x00000002,
LEFTUP = 0x00000004,
MIDDLEDOWN = 0x00000020,
MIDDLEUP = 0x00000040,
MOVE = 0x00000001,
ABSOLUTE = 0x00008000,
RIGHTDOWN = 0x00000008,
RIGHTUP = 0x00000010
}
static void Main(string[] args)
{
IntPtr cameraHandle;
cameraHandle = FindWindow(null, "Camera");//search camera app
if (cameraHandle == IntPtr.Zero)// cannot find it then launch it
{
Process cam = Process.Start(new ProcessStartInfo("Camera.exe", ""));
//cameraHandle = cam.MainWindowHandle;
}
else // can find it then set position then click
{
//SetForegroundWindow(cameraHandle);// we assume we already have the focus on the camera app
SetCursorPos(240, 750 );//set position to the on-screen camera button
mouse_event((uint)MouseEventFlags.LEFTDOWN, 0, 0, 0, 0);
mouse_event((uint)MouseEventFlags.LEFTUP, 0, 0, 0, 0);
}
}
}
}
Why do I give the code rather than the binary?
Because unfortunately this code doesn't work (yet).
Let me explain a bit more:
This application doesn't need to keep running in the background, it just can do 2 things. Start the camera app if it's not already started, or just click at a specifically chosen position.
If I set the position to (0,0), my program will click at the upper-left corner of the screen, and hit the start button, therefore the start menu appears.
However if I try to click on the camera application, it doesn't have any effect!
Actually if I click somewhere else than the on-screen camera button, it should still react to the click: the little cross should move to the clicked place as part of the Touch Focus feature of HTC's camera app.
But here again, nothing happen.
Since it's my first app on WiMo, I might have done a mistake somewhere, but I can't see where.
Any XDA-developer can spot what's wrong with my code?
please see http://forum.xda-developers.com/showthread.php?t=471321
The Problem is the HTC Application, it blocks any keydown event
I did it Application released soon!
http://www.scilor.com/leocameraanykey.html

[Q] HW Button, Finger Gesture, Bluetooth & input panel for HTC HD2

Help...!! I'm new with WM developing,
There are 4 questions I'm about to ask about HTC HD2 using WM6.5:
1. How to disable hardware function and handle their event 'on press' for every HW button (such as Home, Window, Talk, End and Back button)?
So far, I just able to disable it using :
[DllImport("coredll.dll")]
private static extern bool UnregisterFunc1(KeyModifiers modifiers, int keyID);
[DllImport("coredll.dll", SetLastError = true)]
public static extern bool RegisterHotKey(IntPtr hWnd, // handle to window
int id, // hot key identifier
KeyModifiers Modifiers, // key-modifier options
int key //virtual-key code
);
Buttons that I can successfully disable are Volume Up, Volume Down, Back, and Talk.
There is no way I can handle or disable Windows, Home and end button.
I have a trick by disable Window button:
IntPtr hTaskBar = FindWindow("HHTaskBar", null);
EnableWindow(hTaskBar, false);
But when I try to lock and unlock the screen using end button, Window button function will not disable anymore.
So far, some forums mention about SHCMBM_OVERRIDEKEY and handle the message by using Microsoft.WindowsCE.Forms.MessageWindow,
and again I still don't know how to attach MessageWindow to my foreground application
2. I'd like if my panel finger gesture behavior works as well as ListView or DataGrid. So, I found a library that can help me.
code.msdn.microsoft.com/gestureswm/Release/ProjectReleases.aspx?ReleaseId=3146
Unfortunatelly, it makes my controls in panel flicker badly. Do you have any other alternative?
3. To handle bluetooth, I'm using
[DllImport("BthUtil.dll")]
public static extern int BthGetMode(out BluetoothMode dwMode);
[DllImport("BthUtil.dll")]
public static extern int BthSetMode(BluetoothMode dwMode);
and InTheHand.Net Library to send data.
But since I'm starting with this device, I even cannot deactive the Bluetooth.
Can you help me with this Bluetooth control and data communication?
4. Since I'm using virtual keyboard as my input, How to define what kind of input panel it will show?
For Example, if my Textbox1 is focused, I have to show Numeric Keypad.
But if Textbox2 is focused, I have to show Qwerty keyboard.
Thank you very much.
PS : I'm using C# for developing the application. It'll be very good if you give me a C# example for those questions.
I know this is a few months old, and I don't wanna ressurect it per-say - and i'm not farmiliar with the rules as it relates to posting on these forums, but i've been viewing them forever, and as a member for a few months at least, and i've got to say that disabling the END key is a must for the HTC HD2, especially for Android NAND. At present with my phone, and thousands of others, everytime we press the END button, the screen stops being responsive. Funny thing is, if i NEVER press the end button, my screen works great. I end calls using the screen, and i've installed 'Button Saviour' from the market to use the 'END' button virtually on-screen, and I wake the phone using any of the other 4 buttons, save for 'END', and i get no problems. It's the Damned signal sent to the screen from the END button that causes the screen to disable and never re-enable the digitizer - I am just supposing these things, I'm in no way or shape a developer... Just something to think about?
This could be the end to thousands of HTC HD2 end user issues relating to lockscreen lock up in Android or otherwise...

[Q] Need Help with a problem

I am using one edit text view and one OK button to input a large amount of user data during a setup function but can't figure out how to pause the thread execution unit the OK button is pressed. I don't want to have to register and use a ton of different buttons and listeners to call individual functions for each user input and so far I've found out the hard way that a while look will lock the UI thread and running the loop in a separate thread will not make the program wait. Any Ideas?
public class SetupMenuActivity extends Activity
{
private TextView setupPrompt;
boolean okButtonPressed = false;
@override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.setup_menu);
setup();
}
private OnClickListener okButtonListener = new OnClickListener()
{
@override
public void onClick(View v)
{
okButtonPressed = true;
}
};
private void setup()
{
Button okButton = (Button) findViewById(R.id.okButton);
okButton.setOnClickListener(okButtonListener);
setupPrompt = (TextView) findViewById(R.id.setupPrompt);
setupPrompt.setText("Please Enter Your Name");
// Make program wait for ok button clicked
setupPrompt.setText("Please Enter a Name for your Account");
}
}
What else could the user click/etc that you want to prevent from happening? If you want to block another button, then you can either do button.setClickable(false) or even button.setVisibility(View.GONE) until the ok button is clicked. Instead blocking the whole thread doesn't make much sense
The only two things the user can interact with is the button and the edit text box. I want to prevent the changing of the setupPrompt text view until the Ok button is pressed. The easy way to do it would be to put it into the onClickListener but there is a whole series of the prompts and waiting for user input so I'm trying to avoid creating a ton of different button listeners for each piece of user input.
TShipman1981 said:
The only two things the user can interact with is the button and the edit text box. I want to prevent the changing of the setupPrompt text view until the Ok button is pressed. The easy way to do it would be to put it into the onClickListener but there is a whole series of the prompts and waiting for user input so I'm trying to avoid creating a ton of different button listeners for each piece of user input.
Click to expand...
Click to collapse
The way you think this would work is not right, you have to think through it again, sorry . In Android, you can almost never wait for user events (because they might not happen). Instead, you have to do what you can during setup and everything that can only happen after a certain event has to be in the onEvent method (for instance onClick). What you can do to make it less complex is one method which is called only from the onClickListener. The method keeps track of how many times it has been called with an int step instance variable. That method has to execute what should happen at each step.
SimplicityApks said:
The way you think this would work is not right, you have to think through it again, sorry . In Android, you can almost never wait for user events (because they might not happen). Instead, you have to do what you can during setup and everything that can only happen after a certain event has to be in the onEvent method (for instance onClick). What you can do to make it less complex is one method which is called only from the onClickListener. The method keeps track of how many times it has been called with an int step instance variable. That method has to execute what should happen at each step.
Click to expand...
Click to collapse
Yeah Agreed with Simp. I would honestly make one method with all the info you need then get all the info and call it only when the button is clicked. If I knew a bit more of what your trying to accomplish I might be able to help you code it more efficiently.

[Q] assign Menu tu child of TabActivity

Hi there
I'm working on an application for light controll. I start a TabActivity with 2 childs tab "A" and tab "B". in the "onCreateOptionsMenu()" of the TabActivity I am creating the menu for the activitys.
How can I make, that the Activity in tab "A" reacts on clickt on the menu buttons?
I tryed out everything but nothing worked. Im searching at least since 15h.
Greez LoXeras
LoXeras said:
Hi there
I'm working on an application for light controll. I start a TabActivity with 2 childs tab "A" and tab "B". in the "onCreateOptionsMenu()" of the TabActivity I am creating the menu for the activitys.
How can I make, that the Activity in tab "A" reacts on clickt on the menu buttons?
I tryed out everything but nothing worked. Im searching at least since 15h.
Greez LoXeras
Click to expand...
Click to collapse
Something like this question? You need to override onPrepareOptionsMenu for different menus based on what tab is currently active. Then, in the onOptionsItemSelected just pass the selected item to the specific tab.
SimplicityApks said:
Something like this question? You need to override onPrepareOptionsMenu for different menus based on what tab is currently active. Then, in the onOptionsItemSelected just pass the selected item to the specific tab.
Click to expand...
Click to collapse
Thanks for the answere. This is what I tried. but I get crashes every time. A NullPointerException occurs every time. And if I try to select the hitten items in menu with the menu button it crasshes instantly.
Source:
Code:
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle presses on the action bar items
command co = new command();
switch (item.getItemId()) {
case R.id.action_load:
co.LoadFile();
return true;
case R.id.action_clear:
co.clearlist();
return true; case R.id.action_save:
co.SaveFile();
return true;
case R.id.action_as:
co.AutoScroll();
return true;
case R.id.action_info:
co.showInfo();
return true;
default:
return super.onOptionsItemSelected(item); //Return selected item
}

Categories

Resources