Block Hardware back button JUST in rootPage

I need help in locking Hardware back button in rootPage. Unfortunately when I override its behavior with platform.registerBackButtonAction() the button is locked in all the app.
This what I tried in my homepage:

priority:number;
 ngAfterViewInit() {
    this.platform.registerBackButtonAction(() => {
      if (!this.navCtrl.canGoBack()) this.priority = 1
      else this.priority = -2000
     
    }, this.priority);
  }
  ionViewDidLeave() {
    this.priority = -2000
  }

Any ideas please ? help

Take a look at his:

Using registerBackButtonAction harm the UX. I have a delay of 650 ms whenever I press the hardware back button.