Tuesday, February 25, 2014

Android 4.0's HOME key how to shield ah?


Will you have contact with the shield ANDROID 4.0 HOME shielding the code?
Currently using 2.2 and 2.3 in this method can not shield the HOME key. Also want an experienced person to give advice. Thank you.<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Own rom, related processing to remove the home, only in the application can not be done.
Reply:
Did not see 4.0 source code, I do not know how to do. 2.3 can engage
Reply:
Own ROM, this so hard ah?
Reply:
reference to the third floor tody_guo reply:
own ROM, this so hard ah?


Make an application and customize a system ROM is certainly not a workload
Reply:
Do a rom too exaggerated
Reply:
Re
inside the Activity@ Override
public void onAttachedToWindow () {
this.getWindow () setType (WindowManager.LayoutParams.TYPE_KEYGUARD);. / / TYPE_KEYGUARD_DIALOG
super.onAttachedToWindow ();
}
Reply:
reference to the 6th floor kechanghe0705 reply:
re
inside the Activity@ Override
public void onAttachedToWindow () {
this.getWindow () setType (WindowManager.LayoutParams.TYPE_KEYGUARD);. / / TYPE_KEYGUARD_DIALOG
super.onAttachedToWindow ();
}


This is not, directly crashes 4.0
Reply:
Home shielding applications or shielding systems Home?
Reply:
Want to shield system HOME.
Reply:
Think too much, as on the first floor said the answer
Reply:
Do not understand the needs ~ ~
Reply:
2.3 Closed systems can screen the HOME key, before the product I do, there should be 4.0, but now do not handle transplanting stage which step
Reply:
You can look at this, Android system onKeyDown monitor / intercept / monitor / screen Back key, menu key , Home key
Reply:
@ Override
public void onAttachedToWindow () {
super.onAttachedToWindow ();
this.getWindow () addFlags (WindowManager.LayoutParams.FLAG_HOMEKEY_DISPATCHED);.

}
Reply:
Home key underlying control, it seems impossible to control with java
Reply:
reference to the 7th floor of replies:
reference to the 6th floor kechanghe0705 reply:

Re
inside the Activity@ Override
public void onAttachedToWindow () {
this.getWindow () setType (WindowManager.LayoutParams.TYPE_KEYGUARD);. / / TYPE_KEYGUARD_DIALOG
super.onAttach ......
incompatible, totally not recommended.
Reply:
Please do a little logical thinking good programmer, you make a third-party software shields the home button, menu key return key and then shielded, full-screen, set to boot, this phone can use it? This system can also fire it?

San Leba. . . .
Reply:
Only for testing purposes only. Do not be a third-party software.
Reply:
The reply was deleted at 2012-04-20 10:35:58 moderator

Reply:
@ Override
public void onAttachedToWindow () {
this.getWindow () setType (WindowManager.LayoutParams.TYPE_KEYGUARD);. / / TYPE_KEYGUARD_DIALOG
super.onAttachedToWindow ();
}
Reply:
If I used the wrong words in 4.0 above, looks like it is not.
Reply:
reference to the 18th floor Re: The purpose
just testing it. Do not be a third-party software.


The world is not the only one programmer ah. . Not all have the programmer's self-cultivation ah. . .
Reply:
Recent studies lock screen, according to a conventional method, the conventional method is as follows
Java code Collection code

public void onAttachedToWindow ()
{
this.getWindow () setType (WindowManager.LayoutParams.TYPE_KEYGUARD);.
super.onAttachedToWindow ();
}

But this approach to the 4.0 system failure, according to still return home desktop. found that the implementation of several lock screen after apktool software, which uses WindowManager view of addview method applied to the window, with the view of layoutparamas when the type is set LayoutParams.TYPE_SYSTEM_ERROR, this value is interpreted as sdk < br />

Java code Collection code

public static final int TYPE_SYSTEM_ERROR
Since: API Level
1Window type: internal system error windows, appear on top of everything they can
.
If so used will complain directly, but also in AndroidManifest.xml inside with permission , the complete code ok, Packaging, a category in which Lock and hide methods to achieve lock and unlock the screen.
Java code Collection code

public class LockLayer {
private Activity mActivty;
private WindowManager mWindowManager;
private View mLockView;
private LayoutParams mLockViewLayoutParams;

public LockLayer (Activity act) {
mActivty = act;
init ();
}

private void init () {
mWindowManager = mActivty.getWindowManager ();
mLockViewLayoutParams = new LayoutParams ();
mLockViewLayoutParams.width = LayoutParams.MATCH_PARENT;
mLockViewLayoutParams.height = LayoutParams.MATCH_PARENT;
/ / Key to achieving
mLockViewLayoutParams.type = LayoutParams.TYPE_SYSTEM_ERROR;
/ / Apktool value, the value of specific variables which also requested help users
mLockViewLayoutParams.flags = 1280;
}
public void lock () {
if (mLockView! = null) {
mWindowManager.addView (mLockView, mLockViewLayoutParams);
}
}
public void unlock () {
if (mWindowManager! = null) {
mWindowManager.removeView (mLockView);
}
}
public void setLockView (View v) {
mLockView = v;
}
}

Use the following
Java code Collection code

public void onCreate (Bundle savedInstanceState) {
super.onCreate (savedInstanceState);
View lock = View.inflate (this, R.layout.main, null);
LockLayer lockLayer = new LockLayer (this);
lockLayer.setLockView (lock);
lockLayer.lock ();
}



ok, then press the home button can not return to the desktop effects, other keys need to use an additional code, the Internet has. This code is called only once when there is no problem, but if you encounter a multi-threaded or multiple lock and hide there will be problems, modified as follows, one will LockLayer to single mode, the second is in hide and lock when the first determine the state. After modifying the code below
Java code Collection code

public class LockLayer {
private Activity mActivty;
private WindowManager mWindowManager;
private View mLockView;
private LayoutParams mLockViewLayoutParams;
private static LockLayer mLockLayer;
private boolean isLocked;

public static synchronized LockLayer getInstance (Activity act) {
if (mLockLayer == null) {
mLockLayer = new LockLayer (act);
}
return mLockLayer;
}

private LockLayer (Activity act) {
mActivty = act;
init ();
}

private void init () {
isLocked = false;
mWindowManager = mActivty.getWindowManager ();
mLockViewLayoutParams = new LayoutParams ();
mLockViewLayoutParams.width = LayoutParams.MATCH_PARENT;
mLockViewLayoutParams.height = LayoutParams.MATCH_PARENT;
/ / Key to achieving
mLockViewLayoutParams.type = LayoutParams.TYPE_SYSTEM_ERROR;
/ / Apktool value, the value of specific variables which also requested help users
mLockViewLayoutParams.flags = 1280;
}
public synchronized void lock () {
if (mLockView! = null &&! isLocked) {
mWindowManager.addView (mLockView, mLockViewLayoutParams);
}
isLocked = true;
}
public synchronized void unlock () {
if (mWindowManager! = null && isLocked) {
mWindowManager.removeView (mLockView);
}
isLocked = false;
}
public synchronized void setLockView (View v) {
mLockView = v;
}
}

There is a problem mLockViewLayoutParams.flags = 1280; 1280 this value did not know specifically which variables have to know leave a message.

LockScreen.zip (148.2 KB)
Downloads: 0


Reply:
LayoutParams.FLAG_FULLSCREEN + LayoutParams.FLAG_LAYOUT_IN_SCREEN = 1280;
Reply:
cited 23 F reply:
recent study lock screen, according to the conventional method, the conventional method is as follows
Java code Collection code

public void onAttachedToWindow ()
{
this.getWindow () setType (WindowManager.LayoutParams.TYPE_KEYGUARD);.
super.onAtt ......

Reply:
Own rom, home-related processing to remove
Reply:
23 F. buddies too cattle X! ! !
Reply:
cited 22 F reply:
reference to the 18th floor Replies:

Only for testing purposes only. Do not be a third-party software.


The world is not the only one programmer ah. . Not all have the programmer's self-cultivation ah. . .

Can shield before 4.0 Home key, which applications have not seen hurting the user's mobile phone, ah, I also recently tested the software used to write a test facility to test the home button is available, I used some of the factory test software counterparts, found this it can be done, if you can not, do not use the moral dimension to despise others, not everyone learn something is to do evil, and this is just a project needs.
Reply:
Can contribute what way? Oh, I still have not solved this problem. Oh
Reply:
reference to the 17th floor Reply:
please do a little logical thinking good programmer, you want to be shielding the home key third-party software, and then shielded Menu key to return key, full-screen, set to boot, this phone can use it? This system can also fire it?

San Leba. . . .


Free tablet device only to specific needs of specific businesses to use such software Is it unreasonable
Reply:
public void onAttachedToWindow () {
this.getWindow (). setHomeKeyEnable (
WindowManager.LayoutParams.HOME_KEY_INTERCEPT_ENABLE);
this.getWindow () setType (WindowManager.LayoutParams.TYPE_KEYGUARD);.
super.onAttachedToWindow ();
}

After version 4.0, shielding the Home key, need to do so
Reply:
cited 31 floor lsqwdx91805605 reply:
public void onAttachedToWindow () {
this.getWindow (). setHomeKeyEnable (
WindowManager.LayoutParams.HOME_KEY_INTERCEPT_ENABLE);
this.getWindow () setType (WindowManager.LayoutParams.TYPE_KEYGUARD);.
super.onAttachedToWindow ();
}

After version 4.0, shielding the Home key, need to do so


Do not fly, sdk methods setHomeKeyEnable and red flag HOME_KEY_INTERCEPT_ENABLE are not ah.
Reply:
cited 32 floor liuborama reply:
Quote: references 31 F lsqwdx91805605 reply:

public void onAttachedToWindow () {
this.getWindow (). setHomeKeyEnable (
WindowManager.LayoutParams.HOME_KEY_INTERCEPT_ENABLE);
this.getWindow () setType (WindowManager.LayoutParams.TYPE_KEYGUARD);.
super.onAttachedToWindow ();
}

After version 4.0, shielding the Home key, need to do so


Do not fly, sdk methods setHomeKeyEnable and red flag HOME_KEY_INTERCEPT_ENABLE are not ah.



This should be FLAG_HOMEKEY_DISPATCHED
SetAttributes pass directly into the can
Reply:
cited 31 floor lsqwdx91805605 reply:
public void onAttachedToWindow () {
this.getWindow (). setHomeKeyEnable (
WindowManager.LayoutParams.HOME_KEY_INTERCEPT_ENABLE);
this.getWindow () setType (WindowManager.LayoutParams.TYPE_KEYGUARD);.
super.onAttachedToWindow ();
}

After version 4.0, shielding the Home key, need to do so
you do succeed? Impossible to find methods and constants
Reply:
cited a floor ultrapro reply:
own rom, related processing to remove the home, only in the application can not be done.


Let me feel
Reply:

reference to the 17th floor Reply:
please do a little logical thinking good programmer, you want to be shielding the home key third-party software, and then shielded Menu key to return key, full-screen, set to boot, this phone can use it? This system can also fire it?

San Leba. . . .

In fact, just to be unlocking software
Reply:
cited 23 floor tody_guo reply:
recent study lock screen, according to the conventional method, the conventional method is as follows
Java code Collection code

public void onAttachedToWindow ()
{
this.getWindow () setType (WindowManager.LayoutParams.TYPE_KEYGUARD);.
super.onAttachedToWindow ();
}

But this approach to the 4.0 system failure, according to still return home desktop. found that the implementation of several lock screen after apktool software, which uses WindowManager view of addview method applied to the window, with the view of layoutparamas when the type is set LayoutParams.TYPE_SYSTEM_ERROR, this value is interpreted as sdk < br />

Java code Collection code

public static final int TYPE_SYSTEM_ERROR
Since: API Level
1Window type: internal system error windows, appear on top of everything they can
.
If so used will complain directly, but also in AndroidManifest.xml inside with permission , the complete code ok, Packaging, a category in which Lock and hide methods to achieve lock and unlock the screen.
Java code Collection code

public class LockLayer {
private Activity mActivty;
private WindowManager mWindowManager;
private View mLockView;
private LayoutParams mLockViewLayoutParams;

public LockLayer (Activity act) {
mActivty = act;
init ();
}

private void init () {
mWindowManager = mActivty.getWindowManager ();
mLockViewLayoutParams = new LayoutParams ();
mLockViewLayoutParams.width = LayoutParams.MATCH_PARENT;
mLockViewLayoutParams.height = LayoutParams.MATCH_PARENT;
/ / Key to achieving
mLockViewLayoutParams.type = LayoutParams.TYPE_SYSTEM_ERROR;
/ / Apktool value, the value of specific variables which also requested help users
mLockViewLayoutParams.flags = 1280;
}
public void lock () {
if (mLockView! = null) {
mWindowManager.addView (mLockView, mLockViewLayoutParams);
}
}
public void unlock () {
if (mWindowManager! = null) {
mWindowManager.removeView (mLockView);
}
}
public void setLockView (View v) {
mLockView = v;
}
}

Use the following
Java code Collection code

public void onCreate (Bundle savedInstanceState) {
super.onCreate (savedInstanceState);
View lock = View.inflate (this, R.layout.main, null);
LockLayer lockLayer = new LockLayer (this);
lockLayer.setLockView (lock);
lockLayer.lock ();
}



ok, then press the home button can not return to the desktop effects, other keys need to use an additional code, the Internet has. This code is called only once when there is no problem, but if you encounter a multi-threaded or multiple lock and hide there will be problems, modified as follows, one will LockLayer to single mode, the second is in hide and lock when the first determine the state. After modifying the code below
Java code Collection code

public class LockLayer {
private Activity mActivty;
private WindowManager mWindowManager;
private View mLockView;
private LayoutParams mLockViewLayoutParams;
private static LockLayer mLockLayer;
private boolean isLocked;

public static synchronized LockLayer getInstance (Activity act) {
if (mLockLayer == null) {
mLockLayer = new LockLayer (act);
}
return mLockLayer;
}

private LockLayer (Activity act) {
mActivty = act;
init ();
}

private void init () {
isLocked = false;
mWindowManager = mActivty.getWindowManager ();
mLockViewLayoutParams = new LayoutParams ();
mLockViewLayoutParams.width = LayoutParams.MATCH_PARENT;
mLockViewLayoutParams.height = LayoutParams.MATCH_PARENT;
/ / Key to achieving
mLockViewLayoutParams.type = LayoutParams.TYPE_SYSTEM_ERROR;
/ / Apktool value, the value of specific variables which also requested help users
mLockViewLayoutParams.flags = 1280;
}
public synchronized void lock () {
if (mLockView! = null &&! isLocked) {
mWindowManager.addView (mLockView, mLockViewLayoutParams);
}
isLocked = true;
}
public synchronized void unlock () {
if (mWindowManager! = null && isLocked) {
mWindowManager.removeView (mLockView);
}
isLocked = false;
}
public synchronized void setLockView (View v) {
mLockView = v;
}
}

There is a problem mLockViewLayoutParams.flags = 1280; 1280 this value did not know specifically which variables have to know leave a message.

LockScreen.zip (148.2 KB)
Downloads: 0





I used this source to source website can not be used directly, junior I did not see it works. Direct abandoned. . . . . . . .
Reply:
cited 28 floor twoicewoo reply:
[Quote = 22 Floor cited reply:]

References to the 18th floor Replies:

Only for testing purposes only. Do not be a third-party software.


The world is not the only one programmer ah. . Not all have the programmer's self-cultivation ah. . .

Can shield before 4.0 Home key, which applications have not seen hurting the user's mobile phone, ah, I also recently tested the software used to write a test facility to test the home button is available, I used some of the factory test software counterparts, found this it can be done, if you can not, do not use the moral dimension to despise others, not everyone learn something is to do evil, and this is just a project needs.
Reply:
There are no conclusions, just met this demand, looking for solution to the ......
Reply:
Seeking solutions with the same demand solutions
Reply:
Version 4.0 has not been found feasible, to be resolved!

No comments:

Post a Comment