0

I am modifying LockScreen.java in Android source package (4.1.2). Now, I want to getWindow() to add some appropriate flags, such as:

Window window = getWindow();
window.addFlags(WindowManager.LayourParams.FLAG_SHOW_WHEN_LOCKED);

but I don't know how to call this function in a non-Activity class. I tried:

Window window = mContext.getWindow()

but it doesn't work.

I wonder if it is possible to use getWindow() in LockScreen.java?

Cat
  • 66,919
  • 24
  • 133
  • 141
Nguyen
  • 2,019
  • 1
  • 24
  • 31
  • use context of Class which Extends Application where u can get & set context. – Dixit Patel Jan 16 '13 at 04:37
  • Can you explain more clearly? I cannot get your idea – Nguyen Jan 16 '13 at 06:26
  • refer this link to solved context problem http://stackoverflow.com/questions/2002288/static-way-to-get-context-on-android – Dixit Patel Jan 16 '13 at 06:51
  • sorry, but I found that it cannot solve my problem. The main point here is that I am working on the Android's framework, so I cannot use that way. Anyway, thanks for your comments – Nguyen Jan 16 '13 at 07:11

1 Answers1

0

I do not understand what you try to do. From the explanation of WindowManager.LayourParams.FLAG_SHOW_WHEN_LOCKED:

Window flag: special flag to let windows be shown when the screen is locked. This will let application windows take precedence over key guard or any other lock screens.

So from this definition I understand that you want to make a window of ScreenLock before the window of ScreenLock :)

I guess you want to create a Screen that will be shown before ScreenLock window. If yes, I advise you to create a system application with the activity, where you can set this parameter.

Yury
  • 20,618
  • 7
  • 58
  • 86
  • Thanks for your comment. The important point here is that I have to customize the existed lockscreen by modifying LockScreen.java (in Android framework) instead of using system application. This new lockscreen will replace default Android lockscreen in new mobile brand. – Nguyen Jan 21 '13 at 01:44