Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d500f633 authored by Chiao Cheng's avatar Chiao Cheng
Browse files

Show screen during unit test even if locked.

onStart() of ContactDeletionInteration is not called when screen is locked.
This causes NullPointerException's during unit tests.

Bug: 6794863
Change-Id: I2fbb09bebb314521b4a6ab9d23d209d2ad063516
parent 5982547b
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@
package com.android.contacts.test;

import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;

import com.android.contacts.ContactsActivity;
import com.android.contacts.R;
@@ -30,6 +32,13 @@ public class FragmentTestActivity extends ContactsActivity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // Normally fragment/activity onStart() methods will not be called when screen is locked.
        // Use the following flags to ensure that activities can be show for testing.
        Window window = getWindow();
        window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON |
                WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);

        setContentView(R.layout.fragment_test);
    }
}